XF 1.5 Conditional cookies accepted

dutchbb

Well-known member
Is there a conditional statement for when users click the cookie accept banner (or the notice is dismissed, same)? This way i can show personalized ads to who accept and else non-personalized.

An option to show the cookie banner as an overlay would also help.
 
This works in my case (only have the cookie notice). When the dismiss cookie is not set (cookie banner not clicked) non-personalized ads is shown for adsense.

Add to page_container template in head.
Code:
<xen:if is="!{$_COOKIE.xf_notice_dismiss}">
<script>(adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=1;</script>
</xen:if>


The cookie notice id = -1 so that could be added if you have more notices for guests.
Code:
<xen:if is="{$_COOKIE.xf_notice_dismiss} != -1">
 
Last edited:
Top Bottom