Launch Rule to fire when cookie is accepted or cookie is already on browser | Community
Skip to main content
JyotiSharmaV
Community Advisor
Community Advisor
January 28, 2021
Solved

Launch Rule to fire when cookie is accepted or cookie is already on browser

  • January 28, 2021
  • 1 reply
  • 3988 views

Hi. I am looking to implement a Launch rule to trigger when either a user clicks on accept cookie banner or a cookie is already existing on the user browser? what could be the custom code in Launch? Any Step by Step information? Or any other direct way to implement the rule?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by yuhuisg

You can have 2 Rules:

  1. Rule with:
    1. Click event on the cookie banner's "Accept" button
  2. Rule with:
    1. Library Loaded event
    2. Condition that checks for the presence of the cookie

When new users click on the Accept banner, they would cause the 1st Rule to trigger. I assume the cookie banner then sets the cookie.

Subsequently, these users who had already granted consent would have the cookie in their browser, so every page they visit would cause the 2nd Rule to trigger.

1 reply

yuhuisg
Community Advisor
yuhuisgCommunity AdvisorAccepted solution
Community Advisor
January 28, 2021

You can have 2 Rules:

  1. Rule with:
    1. Click event on the cookie banner's "Accept" button
  2. Rule with:
    1. Library Loaded event
    2. Condition that checks for the presence of the cookie

When new users click on the Accept banner, they would cause the 1st Rule to trigger. I assume the cookie banner then sets the cookie.

Subsequently, these users who had already granted consent would have the cookie in their browser, so every page they visit would cause the 2nd Rule to trigger.

JyotiSharmaV
Community Advisor
Community Advisor
January 28, 2021
Thanks @juhuisg For the second rule where you asked to create a library loaded event and then check for the condition Cookie, What to do incase if the cookie value changes and is unique for each user? For example if we have ISO date format as value for each accepted cookie.