I have a requirement where user setting Country code in cookie or local storage.
Then on page load we should get this value and check country code and make condition on basis of that in audience.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @varun790,
I meant by adding the mbox parameter using either the launch or target getoffer method.
adobe.target.getOffer({ "mbox": "target-global-mbox", "params": { "a": 1, "b": 2 }, "success": function(offer) { adobe.target.applyOffer( { "mbox": "target-global-mbox", "offer": offer } ); }, "error": function(status, error) { console.log('Error', status, error); } })
Hi @varun790
Yes, you can able to achieve using Profile Script and that way you can read the cookie and fetch the countryCode value and later used for your defining audience through Visitor Profile section.
Here is the small snippet for read a cookie using Profile script.
// Read a Cookie
var cookies = user.header('cookie');
if (cookies.indexOf('YOUR_COOKIE_VAL') >= 0) {return "true";}
else {return "false";} }
Hope this helps.
Views
Replies
Total Likes
Hi Gokul, Thanks for the reply. I tried the same but it it did not worked.
profile script(get_country_code):- I am saving the cookie in browser as "countryCode=US"
Audience
And then I used this audience on the page, but it did not worked.
Views
Replies
Total Likes
Hi Gokul can you help me getting the cookie values as well here
Views
Replies
Total Likes
Hi @varun790
Since profile scripts run on the server side, direct access to cookie values is not possible. To utilize cookie information at the audience level, first read the cookie value and then pass it as a standard mbox parameter.
Hope this helps!
Views
Replies
Total Likes
I am not using mbox since we have upgraded to Adobe target version V2
Views
Replies
Total Likes
Hi @varun790,
I meant by adding the mbox parameter using either the launch or target getoffer method.
adobe.target.getOffer({ "mbox": "target-global-mbox", "params": { "a": 1, "b": 2 }, "success": function(offer) { adobe.target.applyOffer( { "mbox": "target-global-mbox", "offer": offer } ); }, "error": function(status, error) { console.log('Error', status, error); } })
Views
Like
Replies
Views
Like
Replies