XF 2.2 Template syntax to check Third Party Cookie Consent?

twollert

Active member
Thanks to Siropu I got this code to check the status of the Third Party Cookie Consent:

Code:
<xf:set var="$cookieConsent" value="{$xf.app.request.getCookie('consent')}" />

<xf:if is="$cookieConsent && !contains($cookieConsent, '_third_party')">
    no third party consent
<xf:else />
    third party consent / no option selected yet
</xf:if>

How can this be modified to

  • first option "no option selected yet / no third party consent" and
  • second option "third party consent given"

?

Thanks for your help!
 
Solution
Your code is not correct, if fact it somewhat bypasses the consent system.

HTML:
<xf:if is="$xf.cookieConsent.isThirdPartyConsented('google_adsense')">
We've got consent for Google AdSense
<xf:else />
We have no consent for AdSense - either because we have no consent innformation at all or because 3rd party was rejected
</xf:if>

With google_adsense being the identifier for the 3rd party.
Your code is not correct, if fact it somewhat bypasses the consent system.

HTML:
<xf:if is="$xf.cookieConsent.isThirdPartyConsented('google_adsense')">
We've got consent for Google AdSense
<xf:else />
We have no consent for AdSense - either because we have no consent innformation at all or because 3rd party was rejected
</xf:if>

With google_adsense being the identifier for the 3rd party.
 
Last edited:
Solution
Back
Top Bottom