-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why send consent POST on each request? #2
Comments
Quick input: This could be because
But I might be wrong about this. Need to check in some point. |
It happened on our site too (not using swup.js), that's why I opened the issue. I just didn't want to post that site URL so I found out it happens on dude.fi which was better showcase. |
Cookie Consent's onAccept is triggered on each page load. I managed to fix this like this, add a new callback airCookieSettings.onFirstAction = function() {
airCookierecordConsent();
} Then commenting out <?php // Allow adding categiry specific javascript to be runned when the category is accepted.
if ( ! empty( $cookie_categories ) && is_array( $cookie_categories ) ) : ?>
airCookieSettings.onAccept = function() {
// airCookierecordConsent(); // THIS LINE IS THE PROBLEM, BECAUSE CONSENT calls onAccept on each request
<?php foreach ( $cookie_categories as $cookie_category ) {
echo do_category_js( $cookie_category ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} ?>
} I think they have changed many things in 3.0.0, because there is now |
Hmm, I see. We should upgrade to 3 in some point (#3). In the meantime you could send a PR about your fix? |
I was about to send PR, but I don't think it's useful anymore because there is now this excellent PR for upgrading directly 3.0 that also fixes this: #4 |
Reproduce:
I see POST https://www.dude.fi/wp-json/air-cookie/v1/consent on each request:
dude-fi-consent-POST.mp4
The text was updated successfully, but these errors were encountered: