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

Read cookie using target profile script

Avatar

Avatar
Validate 1
Level 2
rajarajanr71853
Level 2

Likes

8 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
rajarajanr71853
Level 2

Likes

8 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
rajarajanr71853
Level 2

02-02-2016

Hi All,

How can i read cookie value in target profile script?

I tried to use this script "user.header('cookie')". But i don't know how to get specific cookie value.

Kindly help me.

Thank you,

Rajarajan R

Replies

Avatar

Avatar
Validate 1
Level 2
RajneeshGautam-
Level 2

Likes

15 likes

Total Posts

9 posts

Correct Reply

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

Avatar
Validate 1
Level 2
RajneeshGautam-
Level 2

Likes

15 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
RajneeshGautam-
Level 2

04-02-2016

Hi Raja,

 

You can use following code to read specific cookie:

var cookieName = 'aam_tnt';

var headerCookie = "; " + document.cookie;

var parts = headerCookie.split("; " + cookieName + "=");

  if (parts.length == 2) return parts.pop().split(";").shift(); 

 

Hope this helps

 

Rajneesh

Avatar

Avatar
Validate 1
Level 2
rajarajanr71853
Level 2

Likes

8 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
rajarajanr71853
Level 2

Likes

8 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
rajarajanr71853
Level 2

04-02-2016

Hi Rajneesh,

We can't use plan JS inside Profile Script. Its throwing error if i use it. We can only use the mbox API.

I tried using user.header('cookie'),but i don't know how to get exact value of a cookie.

And i even tried with mboxFactoryDefault.getCookieManager()​.getCookie(name), its not working .

Regards,

Rajarajan R

Avatar

Avatar
Validate 1
Level 1
ruchaj45469490
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
ruchaj45469490
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

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

10-03-2016

Hi Raja,

I have also encountered a similar issue with reading cookie's in a profile script.

Were you able to find a solution?

Regards,

Rucha

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

10-03-2016

The user. scripts are server side and cookies are client side.  Here is an easy example to do this:

 

http://www.testandtargeting.com/demo/cookie/

There is a function that is added to the mbox.js at the bottom and take a look what is added to the mboxCreate.  

Avatar

Avatar
Validate 1
Level 2
rajarajanr71853
Level 2

Likes

8 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
rajarajanr71853
Level 2

Likes

8 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
rajarajanr71853
Level 2

10-03-2016

Hi Rucha,

You can pass the cookie value using Page Parameter or mBox Parameter. And you can find the name"offercode" in Target audiences under visitor profile.

By Page Parameter : (Page level Code)

targetPageParams = function() { return { "offercode": getCookie("name"); }; };

Check this https://marketing.adobe.com/resources/help/en_US/target/ov/c_pass_parameters_to_global_mbox.html

By mBox Parameter (Page level Code)

mboxCreate('mboxname','offercode='+getCookie("name"));

Check this https://marketing.adobe.com/resources/help/en_US/target/ov/t_orderconfirm_create.html 

You can find the offercode parameter under audience -> visitor profile

 

Rajarajan R

Avatar

Avatar
Validate 1
Level 3
eric9876588
Level 3

Likes

31 likes

Total Posts

17 posts

Correct Reply

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

Avatar
Validate 1
Level 3
eric9876588
Level 3

Likes

31 likes

Total Posts

17 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
eric9876588
Level 3

31-07-2018

The link doesn't seem to work