Phil
Forum Replies Created
-
Forum: Plugins
In reply to: [Age Gate] Always show the popupYou can prevent the cookie from being set to get this behaviour:
add_filter('age_gate/cookie/set', '__return_false');Thanks
Forum: Plugins
In reply to: [Age Gate] Not age restricting theeventscalendar default pageSure, go to Age Gate -> Content and there should be an option under Archives to bypass “Events”
Thanks
PhilForum: Plugins
In reply to: [Age Gate] Age gate conflict with Kadence Blocks product sliderI can see what is happening, but not why.
it looks like there’s a ln error happening just before the end of the document, so the JavaScript isn’t loading at all causing the slider and age gate to not render. If you have access to the logs it should hint as to why.
I’m away the next few day but can look to fix early next week if there’s something obvious in the logs
thanks
Phil
Forum: Plugins
In reply to: [Age Gate] Age gate conflict with Kadence Blocks product sliderHi @webbaronbe – which version of age gate was it working with and is it not working with the latest (3.6.2)?
I’m not sure anything should affect a front end slider from the most recent updates and as the product slider is premium, it’s going to be tough to properly debug. If you can re-enable age gate I can have a look for any obvious front end errors?
I have tried their standard gallery carousel without any issues though.
Thanks
PhilForum: Plugins
In reply to: [Age Gate] Age Gate clashing with WOOF pluginHi @budzdeli and @denniepasman – this has now been resolved in v3.6.2.
Thanks
PhilForum: Plugins
In reply to: [Age Gate] Load Age Gate before and above Klaviyo pop up and Cookie BannerHi @mrkarecki,
Let’s start with the easier of the two, the popups. Looks like some of them are being a bit greedy with the z-index, so you need age gate to be greedier, you can add this css somewhere like the customizer, or your own css file:
:root {
--ag-form-z-index: 10000000000; /* Super high to be on top of the cookie banner */
}There is a drawback where the email popup hides with any click outside of it so that won’t show after the user has interacted with age gate, but you could look at the js event of
age_gate_hiddento try and re-trigger it:window.addEventListener('age_gate_hidden', () => {
// code to re-trigger the popup
// worst case might be able to spoof a click on the 30% in the bottom right
})Now for the speed it’s showing. It looks like you have a bunch of scripts that are delayed and so quite slow to execute, triggered by having a type of
wphb-delay-type(hummingbird?). That’s probably not really needed for scripts that appear at the bottom of the page. But if you can exclude Age Gate from that it’ll quicken things up.There is also the option to put all the age gate stuff in the head and it will fire as soon as there is a body element. That does create a render blocker though (on my list to make async and eliminate that) and would still need to be excluded from
wphb-delay-typethough.Thanks,
PhilForum: Plugins
In reply to: [Age Gate] Pagespeed Accessibility Aria LabelForum: Plugins
In reply to: [Age Gate] Accessibility errorsForum: Plugins
In reply to: [NSFW] [Age Gate] Age Gate still being cachedHi @jackgoff222,
I’m honestly not sure what they are talking about!
They’ve also confirmed it’s because Age-gate is unable to access Local Storage
Why would this be the case? Unless they are nuking local storage entirely (which doesn’t seem to be happening as I see elementor has access to it and I’d assume Woocommerce does too)
it wouldn’t work with the PSB either way
Not sure why this would be either as there’s nothing that is preventing the cookie being set – and in fact, read. I’m am as confident as I can be that reading and setting the cookie is not the problem;
Looking at the staging site has given some clues though. Let me walk through what I’m seeing:
- I visit the site, no cookie is set
- Age Gate shows and the HTML has the classes
age-gate__restricted age-gate__restricted--jsappended. This happens when we check for the cookie and it doesn’t exist. So, so far things are as expected. - However, inspecting the code, the
<template>tag that stores the Age Gate pop up is empty. This is not what I would expect - If I run
age_gate_hide()in the console, Age Gate is hidden - But if I then run
age_gate_show()in the console, it doesn’t return and I’m greeted with and load of errors (errors are expected without the markup)
- Age Gate shows and the HTML has the classes
- So now I refresh, and click “Yes”.
- I can see the cookie is now set
- On refresh, the cookie is still set and – critically –
age-gate__restricted age-gate__restricted--jsare not present on the HTML element. This is because Age Gate has successfully read the cookie and has determined we don’t need to show the Age Gate. - But the form is still present, why?
So for the last point, the empty
templatetag for age gate is probably the tell. Looking at how nitropack adds things to the page it looks like everything is being wrapped in atemplatetag which is later added to the DOM. This seems to happen all the time so is probably in their tools that construct the final HTML output.Ways to resolve the issue I think are:
- Nitro pack does not empty template indiscriminately into the HTML or;
- In the Age Gate Advanced settings you could change the Template render element to ‘script element’ and see if that works or;
- There’s a way to omit the Age Gate template from their output which might be possible with the
nitro-excludeattribute.
For the last option there, I’ve updated the dev build on the same url as before and you can add the following to your functions.php:
add_action('init', function(){
age_gate_add_attribute('age-gate-template', 'nitro-exclude', '');
});Hopefully one of those ways will solve it. Like I say, I am confident cookies are not the issue and the support team there are giving you the wrong info.
If you have any issues going forward it might be best to reach out via the website as I’ll probably be able to give more in-depth options that way if needed.
Thanks
PhilForum: Plugins
In reply to: [NSFW] [Age Gate] Age Gate still being cachedHi @jackgoff222,
I’m pretty sure cookies aren’t the problem as the same thing happens with local storage and only when Nitropack is enabled. I’d hope an optimiser is changing that kind of thing.
Based on what I’ve seen on your site previously – the body/html elements missing classes, the form doing a post to the server – I’m thinking that to optimisation is doing something unexpected to the javascript files, possibly as they’re already mangled and production ready.
So what I suggest is trying it without the pre-optimsed assets and using “raw” ones. To try that, you can go to this page and download and install that version, then go to “Advanced” in Age Gate and check the “Unoptimised Assets”. Then run nitropack as normal with no exclusions etc.
Just to address some of the above though for completeness:
Despite these efforts, the issue persists. To be honest, I’ve run out of ideas on how to troubleshoot this further. I also reviewed the plugin’s documentation, but they don’t provide many details on exactly how the validation works and how it is stored, making it quite challenging to pinpoint the root cause.
A cookie is set, via Javascript that is then read, via javascript to determine if the Age Gate needs to show. There should be no need for omitting this from any caches nor bypassing the cache if it’s set as that’d ultimately mean you have no caching. If this were possible, we could attempt a dynamic content approach based on cookies again – this suggests to me that that is their plan.
The local storage version works in much the same way – but stores the value to local storage rather than a cookie. Only if using the “PHP/Standard” mode does anything happen on the server*
For their bullets:
2. Pages where users have passed the challenge.
That is when the cookie is set
3. Pages where users failed the challenge.
This also happens in some instances – but only if you don’t allow re-challenges.
1. Pages where users haven’t passed the challenge.
This should not be required and would only serve to remove content from the cache. If the cookie isn’t found a null response is returned (again all on the client side so nothing happening on the server). Setting to 0 would also have further reaching consequences as it’ll be seen a an int and might do strange things.
If you can give the unminified assets a try as the next step that’d be the best next step and see if that works out.
Cheers
Phil
* some stuff of course happens server side, but that is just to output content/enqueue files etc and won’t affect what we’re talking about here.Forum: Plugins
In reply to: [Age Gate] Adding a checkbox with link to Terms of AgreementHi @mciac,
There’s no a built in way to do this, but there’s a guide to doing just that in the documentation here.Thanks
PhilForum: Plugins
In reply to: [Age Gate] Pop-up does not show up in Chrome MobileHi @datsyuk,
It looks like the check that gets used to calculate the UI height is returning an odd value on your site. I’ll be replacing it with
dvhin future versions though.For now though, you can add some CSS to the customizer to fix the problem:
.age-gate-wrapper,
.age-gate__wrapper,
.age-restriction {
height: 100vh; /* or 100dvh */
}dvh is supported in pretty much everything
Thanks
PhilForum: Plugins
In reply to: [Age Gate] Can’t get past Age Gate in SafariThanks @kimecho,
I think there’s maybe a server issue, not internal xhr requests are resolving for me on Safari (desktop and mobile) which is why things aren’t working as expected
In the above, the ones in black are external, the last two in red are age gate, schema and refill are CF7. Are you also having issues with contact forms.
Why this would only be in safari I’m not sure.
I also noticed this code:
document.addEventListener("click", function (event) {
let button = event.target.closest(".age-gate-accept"); // Target the button
let ageGateWrapper = document.querySelector(".age-gate__wrapper"); // Target the popup wrapper
if (button && ageGateWrapper) {
console.log("Age gate accepted - hiding popup");
ageGateWrapper.style.display = "none"; // Hide the popup
}
});Is this a workaround for the above?
If you’re up against it time wise, then you could use that code to also set a cookie:
document.addEventListener("click", function (event) {
let button = event.target.closest(".age-gate-accept"); // Target the button
let ageGateWrapper = document.querySelector(".age-gate__wrapper"); // Target the popup wrapper
if (button && ageGateWrapper) {
console.log("Age gate accepted - hiding popup");
ageGateWrapper.style.display = "none"; // Hide the popup
expires = "; expires=" + 0;
document.cookie = 'age_gate' + "=" + 18 + expires + "; path=/";
}
});Far from ideal, and I’d see if you can find why the calls are being rejected in safari on cloudways if you can
Thanks
PhilForum: Plugins
In reply to: [Age Gate] How to hide email signup.Hi @born2herf,
Looks like you have this sorted with some custom CSS and z-indexing. Would’ve been what I suggested.
Thanks
PhilForum: Plugins
In reply to: [Age Gate] Can’t get past Age Gate in SafariHi @kimecho,
If you’re able to activate it on your site I can have a look. Perhaps do it on Friday if today isn’t possible and I’ll be able to have a look over the weekend.
Thanks
Phil - I visit the site, no cookie is set