run JS after accept
-
Hi, I have custom element that loads Video via JavaScript, I can’t find a way to trigger loading only after cookiyes banner been approved. Is there any way to do it in free version? Thank you
-
Hi @pixtweaks
Greetings from CookieYes!
Please share the URL of the site where you implemented this custom element.
Hello @cookieyesteam ,
here is staging site, the hero image will load video from vimeo. https://med.speedweb.xyz/fr/
Thank you!Hi @pixtweaks
Please check the working after adding the Vimeo cookies to your Cookie List from CookieYes > Cookie Manager > Cookie List.
@cookieyesteam all vimeo cookies are on the list
Hi @pixtweaks
We checked the banner on your site, and couldn’t find the cookies listed. Please share a screenshot of your CookieYes dashboard > Cookie Manager > Cookie List.
@cookieyesteam https://go.screenpal.com/watch/cZQI6KVRScn
they are on various places, this particular is under analytics tabBut I would rather know if there is a event or some king of trigger I can place into my code, so
when I get in Javascript if user already accepted and what has accepted.Hi @pixtweaks
Please confirm the site https://med.speedweb.xyz/fr/
We couldn’t find cookies listed on the banner on this site.

This is the staging site, I just don’t want to list the domain here so I pass it to you via paste bin for privacy purposes, thank you
https://pastebin.com/V7GBRvuvHi @pixtweaks
Please exclude our script from the JavaScript optimisation on your site.
Hello @cookieyesteam, it has no effect on it. Probably pasebin URL didn’t work as expired. Here is the new one that is valid.
https://pastebin.com/eQPtmufj
There is a query string?LSCWP_CTRL=before_optmthat disables all caches and optimization, so with this you can see it doesn’t have an effect.As I said, I can adjust my code, but I need to know how to get from your code information about cookie approval status.
Thank you!
Hi @pixtweaks
Please refer to this documentation on the cookie banner interaction event and perform the necessary action.
Thank you @cookieyesteam for pointing me in the right direction. Here is the code that works for me, when performance cookies are allowed it will log the console. It may help somebody else.
document.addEventListener(‘cookieyes_consent_update’, function (e) {
if (e.detail && e.detail.accepted.includes(‘performance’)) {
console.log(‘Performance allowed for the first time’);
}
});
document.addEventListener(‘cookieyes_banner_load’, function (e){
if (e.detail && e.detail.categories && e.detail.categories.performance === true) {
console.log(‘Performance allowed repeated load’);
}
});
The topic ‘run JS after accept’ is closed to new replies.