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

Load the rule when cookie exists

Avatar

Avatar
Validate 1
Level 1
krishnay5013323
Level 1

Likes

2 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
krishnay5013323
Level 1

Likes

2 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
krishnay5013323
Level 1

09-07-2019

Hello All,

How i can fire the rule when there is a cookie exists using Adobe DTM?

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 5
kumararajak
Level 5

Likes

119 likes

Total Posts

94 posts

Correct Reply

16 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 5
kumararajak
Level 5

Likes

119 likes

Total Posts

94 posts

Correct Reply

16 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
kumararajak
Level 5

12-07-2019

Hi Krishna,

To fire the rule when there is a cookie exists using Adobe DTM,

Please modify BOLD text from the below JS code as per your requirement and post in the "Customize Page Code" editor and also tick the Check box for Enable EU compliance for Adobe Analytics from the General settings

var loadRule = true;

var ck = getCookie('cookiename');

    if(ck=='cookievalue'){

        loadRule = false;

    }

return loadRule;

function getCookie(cname) {

  var name = cname + "=";

  var decodedCookie = decodeURIComponent(document.cookie);

  var ca = decodedCookie.split(';');

  for(var i = 0; i <ca.length; i++) {

    var c = ca[i];

    while (c.charAt(0) == ' ') {

      c = c.substring(1);

    }

    if (c.indexOf(name) == 0) {

      return c.substring(name.length, c.length);

    }

  }

  return "";

}

Refer the screen shots below

Capture1.0.JPG

Capture1.1.JPG

Capture1.2.JPG

Hope this helps

Regards,

Kumararaja K

Answers (1)

Answers (1)

Avatar

Avatar
Boost 5
Employee
harish_kumar
Employee

Likes

14 likes

Total Posts

35 posts

Correct Reply

13 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile

Avatar
Boost 5
Employee
harish_kumar
Employee

Likes

14 likes

Total Posts

35 posts

Correct Reply

13 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile
harish_kumar
Employee

10-07-2019

You may need to write a custom code in the condition of the rule which will check if the cookie exist then return 'true' which will allow the rule to fire else return 'false'.