Expand my Community achievements bar.

SOLVED

Target DataProvider and regional mbox?

Avatar

Level 2

I need to call a 3rd part service in coordination with an Activity.  I am looking at DataProviders.  How to tell Target (at.js)  which mbox depends on the data provider? That is, if I have 3 mbox, regional not global, on a particular web page and I need only one of these mbox to depend on the data provider, is this possible?  Every example I find so far sets the data providers on targetGlobalSettings only for the global mbox, but can a data provider be passed to getOffers()?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @THE_DK 

 

You can refer the examples here to pass the third party information as mbox parameter

https://docs.adobe.com/content/help/en/target/using/implement-target/client-side/functions-overview/...

 

And 

 

This to fetch the activity content for all the mboxes on the page

https://docs.adobe.com/content/help/en/target/using/implement-target/client-side/functions-overview/...

 

View solution in original post

4 Replies

Avatar

Community Advisor

Seems like you are using AT 2.x so you should be able to pass an optional 3rd param into getOffers with the parameters (profile or mbox) that you need for that single call. You would need to call your data provider prior to running the code below and pass some vars around.

 

adobe.target.getOffers({
  request: {
    execute: {
      mboxes: [
        {
          index: 0,
          name: "first-mbox"
        },
        {
          index: 1,
          name: "second-mbox",
          parameters: {
            a: 1
          },
          profileParameters: {
            b: 2
          }
        }
      ]
    }
  }
});

 

Avatar

Correct answer by
Employee Advisor

Hi @THE_DK 

 

You can refer the examples here to pass the third party information as mbox parameter

https://docs.adobe.com/content/help/en/target/using/implement-target/client-side/functions-overview/...

 

And 

 

This to fetch the activity content for all the mboxes on the page

https://docs.adobe.com/content/help/en/target/using/implement-target/client-side/functions-overview/...

 

Avatar

Level 2

Yes, all three right on that account!  I was reading this though

 

https://docs.adobe.com/content/help/en/target-learn/tutorials/integrations/use-data-providers-to-int...

 

which has a way to abstract this out a bit and let AT make the third party call in a timely way without custom code.  But it appears to only work with global mbox.    Maybe it is the nature of regional mbox though that eschews this data provider abstraction?

Avatar

Employee

@THE_DK 

 

I agree with @Eric_Vidana  that you need call your Datasource before executing GetOffer() and How you call GetOffer() depends on What data you are going get and what are you going to use it for ?

For Example : 

If on your site, a dynamic view will load based on the data coming from your data source then you can choose the selector of that view and make your getoffer() exceute when that view loads.

 

Above is just a random example for a SPA, I would appreciate if you can share your use case in detail.

 

Regards,

Skand