0

I am trying to get GDPR type consent to work on an EE5.1 site.

The methods are pretty much the same as the examples in the EE5 documentation.

Consent cookie is being set OK (I can see it appear in Chrome Inspector when a consent_grant_url button is pressed), but try as I might, I cannot get {consent:ee:cookies_performance} to pick up that a cookies has been set.

The setting code is

{exp:consent:form
    consent='ee:cookies_performance'
    form_id='cookieConsentForm'
    return='{current_uri}'
}
    <button type="submit" name="submit" class="btn btn-success" href="{consent_grant_url}">Accept</button>          
    <button type="submit" name="submit" class="btn btn-outline-info" href="{consent_withdraw_url}">Decline</button>
{/exp:consent:form}

the reading code is

{if consent:ee:cookies_performance}
    Google Tracking Code snippet
{/if}  

but this refuses to fire.

Quoting out the {consent:ee:cookies_performance} tag reveals it to be empty (which explains why conditional won't fire) - but I cannot work out why. I'm sure I'm missing something obvious... any ideas / suggestions would be hugely helpful.. Thanks! (EE5.1.0)

1 Answer 1

0

Solution turns out to be in the setting: some confusion in documentation about how to construct the setting code. But what worked was swapping to use the exp:consent:requests tag, and turning the form buttons into regular anchors. Why it worked ( and / or worked sort-of before) is a mystery - but posting here in case useful to others:

{if ! consent:has_responded:ee:cookies_performance}
<div class="container-fluid cookie-consent" id="cookieConsent">
    <div class="row">
        <div class="col-sm-10">
        {exp:consent:requests
            consent='ee:cookies_performance'
            }
            <h4>{consent_title}</h4>
            <p>{consent_request}</p>
        </div>
        <div class="col-sm-2 align-self-center text-center">
            <a class="btn btn-block btn-success" href="{consent_grant_url}">Accept</a>          
            <a class="btn btn-block btn-outline-info" href="{consent_withdraw_url}">Decline</a>
        </div>
        {/exp:consent:requests}
    </div>
</div>
{/if}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.