Is there currently no way within Target to build an audience based on a cookie value? So if we have a cookie that denotes whether they are a customer or not, we can't build an audience and target a test based on that? If not, are there plans to add this functionality? Both Google Optimize and Optimizely offer this functionality out of the box and is very beneficial in testing. Thanks
Solved! Go to Solution.
Another option is this:
parametersFunction: function() {
function readCookie(name) {
var nameEQ = name + "\x3d";
var ca = document.cookie.split(";");
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == " ") c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length)
}
return null
}
return "parameter" + readCookie("cookie_name");
}
This code just needs to be added parameters section of your mbox.js library. Just update the cookie name in bold and this will automatically pass the cookie value to your mbox as an mbox parameter.
Views
Replies
Total Likes
Hi,
The only way to achieve the above use case is to create a profile script to retrieve & validate a cookie value using the method : mboxFactoryDefault.getCookieManager().getCookie("name") and then create an audience based on that profile script.
For more information , Please see:
https://marketing.adobe.com/resources/help/en_US/target/target/c_script_profile_attributes.html
Regards
Parit Mittal
So is that function something that needs to be included in our mbox.js file during implementation?
Views
Replies
Total Likes
Another option is this:
parametersFunction: function() {
function readCookie(name) {
var nameEQ = name + "\x3d";
var ca = document.cookie.split(";");
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == " ") c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length)
}
return null
}
return "parameter" + readCookie("cookie_name");
}
This code just needs to be added parameters section of your mbox.js library. Just update the cookie name in bold and this will automatically pass the cookie value to your mbox as an mbox parameter.
Views
Replies
Total Likes
Hi Marshall,
As bhawkins showed above you can modify your mbox.js or at.js to pick up a cookie(s) value and pass it into Target for defining audiences off of. Target doesn't pick up your sites cookies by default, which I'm betting is by design for privacy reasons. However, you have the abilty to implement Target so it always see's certain cookies.
Views
Replies
Total Likes
Is it the same if we are using at.js? We just add this:
parametersFunction: function() {
function readCookie(name) {
var nameEQ = name + "\x3d";
var ca = document.cookie.split(";");
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == " ") c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length)
}
return null
}
return "parameter" + readCookie("cookie_name");
}
Views
Replies
Total Likes
Hi Parit,
thanks for the answer! I tried that but it seems like this function is outdated for at.js - at least Target can't run the script because it's invalid. Also the Adobe Help states that "These functions are available when implementing with mbox.js. If you are using at.js, these methods do not apply."
Do you know if there's a similar function for at.js? I wasn't able to find one.
In the meantime I'm using the mbox parameter approach also mentioned in this thread.
Best,
Fabian
Views
Replies
Total Likes
Can you please provide the entire code for the profile script? If I use it as it is Target reports a runtime error.
Views
Like
Replies
Views
Likes
Replies
Views
Like
Replies