Storing and Retrieving data dynamically in Target | Community
Skip to main content
Level 2
March 4, 2020
Solved

Storing and Retrieving data dynamically in Target

  • March 4, 2020
  • 2 replies
  • 10448 views

I currently have an activity that stored product information into the localStorage ~ This is all done through Javascript (custom code option). 
I then read from the local storage and display a popup with the product information on other pages.

Is there a way to move away from localStorage and instead store the product information in Adobe Target instead?
If so, how would I go about this?

I've had a look at profile scripts, thinking that I could send a json object to the profile script to either save a new value or just return what it has stored.
I've looked at mboxes and some adobe.target functions. None of which do what I want or at least I don't think it does. 
I've looked at the targetPageParams() function, but I'm not sure how this works. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ambikaTewari_ATCI

Hi @mark_47 , you are using localStorage it seems you want to use the product info for the session for future use.

 

You can achieve the similar behaviour through mbox profile parameters. Fire a monitoring campaign and its parameters as profile parameters. Please refer below :

 

adobe.target.getOffer({
"mbox": "localMbox",
"params": {
"profile.productId": "12345",
"profile.productCategory":"Clothing"

},
"success": function(offer) {
adobe.target.applyOffer( {
"mbox": "localMbox",
"offer": offer
} );
},
"error": function(status, error) {
console.log('Error', status, error);
}
});

The profile.productId value will remain present for whole session . Hope that helps you

2 replies

ambikaTewari_ATCI
Community Advisor
ambikaTewari_ATCICommunity AdvisorAccepted solution
Community Advisor
March 4, 2020

Hi @mark_47 , you are using localStorage it seems you want to use the product info for the session for future use.

 

You can achieve the similar behaviour through mbox profile parameters. Fire a monitoring campaign and its parameters as profile parameters. Please refer below :

 

adobe.target.getOffer({
"mbox": "localMbox",
"params": {
"profile.productId": "12345",
"profile.productCategory":"Clothing"

},
"success": function(offer) {
adobe.target.applyOffer( {
"mbox": "localMbox",
"offer": offer
} );
},
"error": function(status, error) {
console.log('Error', status, error);
}
});

The profile.productId value will remain present for whole session . Hope that helps you

Mark_47Author
Level 2
March 5, 2020

Hi @ambikatewari_atci ,

Thanks for the response.
Once I've executed the above command, how would I get the profile productId.

My scenario is 1 activity, but 2 pages. The first being the data collecter and the 2nd being the pop-up.
How would I get that value into a javascript variable to use in the 2nd page (the pop-up code).

Thanks :3

Amelia_Waliany
Adobe Employee
Adobe Employee
April 23, 2020

 Hi @mark_47

 

Our next Adobe Target Skill Builder Webinar is right around the corner on May 5th, and will be presented by Adobe Target Product Management on migrating Adobe Target’s mbox.js to At.js. Check out this community discussion to register today. Hope you can make it!
 
Warmly,
Amelia