


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.
Topics help categorize Community content and increase your ability to discover relevant content.
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
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
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
Views
Replies
Sign in to like this content
Total Likes
If I understand the requirement correctly , on 1st page you want to collect the data and on the 2nd page you want to use the colllected data to show the popup. is that right ?
If yes, then on the first page you run the above piece of code . Firstly store all the product info that would like to use in a variable . The you can assign those values the profile mbox parameters.
For Eg.
const productID="12345"; //this is the productID you have
now use this value as mbox profile parameter value :
adobe.target.getOffer({
"mbox": "localMbox",
"params": {
"profile.pdId": productID
},
"success": function(offer) {
adobe.target.applyOffer( {
"mbox": "localMbox",
"offer": offer
} );
},
"error": function(status, error) {
console.log('Error', status, error);
}
});
If you can see this value firing on 1st page, then for 2nd page you can create the audience using "visitor profile > pdID > contains > 12345" and use this for experience (popup) on 2nd page.
Views
Replies
Sign in to like this content
Total Likes
@ambikaTewari_ATCI
Is there no way to actually get that value in the custom code? Like mbox.get('pID') or something, so I can use the data.
The data I'm saving is related to the specific product, saving things like cost, code, descriptions and then on the pop-up screen currently I read the localStorage and display a popup based on the information in the localStorage.
But If I'm understanding this correctly, your solution would require me to create a 'page' for each unique pop-up, I would potentially be hardcoding all the data on each page for each specific product.
Views
Replies
Sign in to like this content
Total Likes
I think I've figured it out. Thanks for the help 🙂
So for anyone else that finds the question:
Once you do the above as stated by @ambikaTewari_ATCI , you can access the value using:
var productId = "${profile.productId}"; // This will parse with the quotes
// OR
var productId = ${profile.productId}; // This will parse it without the quotes.
Views
Replies
Sign in to like this content
Total Likes
@Mark_47 Hi,
I have created a profile script which returns the productid if available
if(profile.get('productId')){
return profile.get('productId');
}
And I have created an audience with the visitors profile by selecting user.userproduct which is my profile script name and how to print the productid in activity ?
Views
Replies
Sign in to like this content
Total Likes
Views
Replies
Sign in to like this content
Total Likes
Hi @Mark_47,
Views
Replies
Sign in to like this content
Total Likes