Preventing Cookie Consent Banners in Synthetic User Journeys
Cookie consent banners and popups are a little like that annoying friend who turns up at your house unannounced when you’re trying to do the washing, asks too many questions and is tricky to get to leave. They’ve also brought their 3 year old with them who’s favourite past time is to pull on your dog’s tail and stare at their private parts. Unlike such visitors, cookie consent banners can be prevented in your synthetic user journeys if you know how.
When writing your journey scripts you will need to account for the possibility of these unwelcome visitors, which might not always be as easy as you think. The popups may be hosted in iFrames, they may require more than one interaction to close or just generally aren’t constructed in a synthetic-friendly way. One way around this is to figure out how the website knows to never show the popup again after you’ve clicked the innocent looking “Accept” button.
Ironically, the way a cookie consent banner remembers your answer to their question is to – brace yourself – store your answer in a cookie. That’s right. Even if you deny consent, they will store that in a cookie. I know…I mean…c’mon.
So how do we figure out what cookie to set to prevent the cookie banner and their 3 year old turning up all over the place?
Checking the Cookies
- Open the target website in a new tab
- Right click, select ‘Inspect Element’
- Select the ‘Application’ tab
- Select ‘Clear Storage’
- Click the ‘Clear Site Data’ button
- Open the ‘Cookies’ list
- Select the domain you’re on
- Refresh the page
- Accept the cookie consent popup
- Check for a new cookie in the cookie jar – be patient, this might take some time
- Note the cookie name and value from the cookie jar (on RapidSpike the name is “cookie_notice_accepted” and the value is “true”)
This process will hopefully have highlighted at least one cookie that might be the one you’re after. If a few appeared or you’re unsure you believe what I’m saying then there is a method for testing it manually.
Testing the Cookies
- Repeat clearing the site data from the previous instructions (part 2)
- Click on the ‘Console’ tab in the Inspect Element area
- Type in
document.cookie = 'name=value'
where ‘name’ and ‘value’ are replaced with the cookie you want to test - Hit enter – the cookie should now appear in your cookie jar
- Refresh the page
- With any luck the cookie consent banner shouldn’t appear
Once you’ve gone through all of this and have a cookie name and value you can reliably use to prevent the cookie banner opening you can go ahead and use the AddCookie
action in the RapidSpike journey builder to add a cookie into the website. Just remember to refresh the page in the journey using a Navigate
action afterwards to ensure the page reloads with the cookie in place.
A Video
Anyway, I made a video to help show you what to do, which in hind sight you could’ve just skipped to.