Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Target Audience Based on Cookie Value

Avatar

Avatar
Validate 1
Level 1
marshallsewell
Level 1

Likes

3 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 1
marshallsewell
Level 1

Likes

3 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
marshallsewell
Level 1

16-05-2017

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 2
bhawkins
Level 2

Likes

2 likes

Total Posts

24 posts

Correct Reply

10 solutions
Top badges earned
Validate 1
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile

Avatar
Validate 1
Level 2
bhawkins
Level 2

Likes

2 likes

Total Posts

24 posts

Correct Reply

10 solutions
Top badges earned
Validate 1
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile
bhawkins
Level 2

17-05-2017

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.  

Answers (6)

Answers (6)

Avatar

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

90 likes

Total Posts

817 posts

Correct Reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

90 likes

Total Posts

817 posts

Correct Reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
ParitMittal
Level 10

17-05-2017

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/r_variables_profiles_parameters_metho...

https://marketing.adobe.com/resources/help/en_US/target/target/c_script_profile_attributes.html

Regards

Parit Mittal

Avatar

Avatar
Boost 1
Level 1
DerRudi
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
DerRudi
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
DerRudi
Level 1

19-07-2018

Can you please provide the entire code for the profile script? If I use it as it is Target reports a runtime error.

Avatar

Avatar
Boost 5
Level 2
fabiant29754507
Level 2

Likes

5 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Boost 5
Level 2
fabiant29754507
Level 2

Likes

5 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
fabiant29754507
Level 2

18-08-2017

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

Avatar

Avatar
Validate 1
Level 1
amardeeps255847
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
amardeeps255847
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
amardeeps255847
Level 1

09-08-2017

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");

}

Avatar

Avatar
Boost 50
Employee
ryanr701
Employee

Likes

188 likes

Total Posts

193 posts

Correct Reply

77 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile

Avatar
Boost 50
Employee
ryanr701
Employee

Likes

188 likes

Total Posts

193 posts

Correct Reply

77 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile
ryanr701
Employee

17-05-2017

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.

Avatar

Avatar
Validate 1
Level 1
marshallsewell
Level 1

Likes

3 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 1
marshallsewell
Level 1

Likes

3 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
marshallsewell
Level 1

17-05-2017

So is that function something that needs to be included in our mbox.js file during implementation?