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

Launch an activity if a cookie is in the page with mbox.js

Avatar

Avatar
Boost 1
Level 1
renatob25477023
Level 1

Likes

2 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
renatob25477023
Level 1

Likes

2 likes

Total Posts

3 posts

Correct Reply

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

30-11-2017

Hi all,

I have a question about on how to target and launch an activity if the user has a cookie on his browser.

I already saw different solutions but apparently any on those seems to work to me, probably I'm missing something.

Could someone explain me step by step what it needs to be done?

Please be aware that this will need to work with mbox.js (so not at.js).


Thank you so much,
Renato

Replies

Avatar

Avatar
Validate 1
Level 3
YogitaBist
Level 3

Likes

20 likes

Total Posts

37 posts

Correct Reply

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

Avatar
Validate 1
Level 3
YogitaBist
Level 3

Likes

20 likes

Total Posts

37 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
YogitaBist
Level 3

30-11-2017

Hi renatob2547702 ,

You could also set cookie using profile script for the targeted page and then use it in audience..

you can find the code for setting cookie in help section if not use the below code :

if (mbox.name == "xy")

{

  // this will set cookie

  user.setLocal('product', 'zz');

  // this is how we read cookies in Test& Target

  var zz = user.getLocal('zz');

  // cookies exist

  if (zz)

  {

  return zz;

  }

}

and then pass the value in audience . user.cookie equals - product

In case you are looking for cookie from other source.. you could use [Not sure if this works i have not tried it, though you could give it a try]

if(document.cookie = "Cookie name") {

// your code

}

Hope this was helpful

Avatar

Avatar
Boost 1
Level 1
renatob25477023
Level 1

Likes

2 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
renatob25477023
Level 1

Likes

2 likes

Total Posts

3 posts

Correct Reply

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

01-12-2017

Hi Yogita, thank you so much for your answer.


I suppose I have to paste the code you wrote inside a profile script.

Question now are:


Since I have only to read the cookie, I think I can remove the line:

// this will set cookie

  user.setLocal('product', 'zz');

Is this correct?


Also, what are exactly "product" and "zz"? It seems like I have to replace these.

Then, when creating the audience based on a visitor profile (so passing a value for the "equals" condition), which value should I pass, product or zz?
If "product", why on the 'read the cookie' code I pass only "zz"?

I know this could be a little bit much but let me know for any question or clarification.


Thank you again,

Renato

Avatar

Avatar
Validate 1
Level 3
YogitaBist
Level 3

Likes

20 likes

Total Posts

37 posts

Correct Reply

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

Avatar
Validate 1
Level 3
YogitaBist
Level 3

Likes

20 likes

Total Posts

37 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
YogitaBist
Level 3

05-12-2017

@renatob25477023 

I am afraid i am not completely aware if you  could read the cookies locally stored in the "browser" with the help of profile script.

We will have to find that out.

You can also go with the second approach ..

you can simply add the condition in your campaign code.

if(document.cookie = "Cookie name") {

// your code

}

1366525_pastedImage_2.png

I would suggest you to try this approach. This will solve your problem without modifying the audience.

Avatar

Avatar
Boost 1
Level 1
renatob25477023
Level 1

Likes

2 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
renatob25477023
Level 1

Likes

2 likes

Total Posts

3 posts

Correct Reply

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

05-12-2017

Hey, thanks for your reply.

Yes, that's what I can not find yet as well.

About last code you sent me, that will work only for apply/not apply the code inside the experiment. But a user will be bucketed in in any case as the cookie condition is not on the audiences, but only in the activity code (so that's not what I am looking for).

If we could find a way to add a cookie check in the targeting rules should be perfect.

But probably Adobe Target is lacking in this.

Avatar

Avatar
Give Back
Level 1
jsvasu
Level 1

Likes

0 likes

Total Posts

38 posts

Correct Reply

0 solutions
Top badges earned
Give Back
View profile

Avatar
Give Back
Level 1
jsvasu
Level 1

Likes

0 likes

Total Posts

38 posts

Correct Reply

0 solutions
Top badges earned
Give Back
View profile
jsvasu
Level 1

27-01-2021

I have a question about how the Launch work if we want to fire a rule where either click on accept cookie banner or cookie is already on user browser? what could be the custom code in Launch?