Closed rimeweb closed 2 years ago
Hi @rimeweb,
I don't see anything wrong with the config.
If you're using any framework with an SPA behavior (React, Vue ...), then this "issue" is the expected behavior. You'd need to manually call ga('send', 'pageview')
between different pages/routes.
If that's not the case, I would need to manually inspect the website/demo with the issue in order to help you.
hello @orestbida, thank you for your reply.
The website is in wordpress, i have also integrated your iframemanager plugin without problems, which works perfectly.
This is url, but in on-line version i inserted the compressed js files (in the local version i have the uncompressed files).
thank you very much for helping
Currently, the plugin is executed as soon as it is loaded. This is fine during the first time, as the script is in a "waiting/paused" state, until the user gives his consent. On subsequent page loads, however, it runs automatically and ignores any and all scripts defined below.
You can fix this in 3 ways:
.run()
method is calleddefer
attribute to the plugin's script tag. This would tell the browser to load the script tag only once everything else has been loaded. If you don't have easy access to the script tag, you could wrap the code with the following function, which would make the script behave as if it had the defer
attribute set:
window.addEventListener('load', function(){
var cc = initCookieConsent();
cc.run({
// your config.
});
});
Hello @orestbida thank you very much for the solutions you proposed to me. I followed solution no. 2 and added the defer attribute to the script.
Now the plugin works perfectly with Google Analytics.
Thanks for your help
Hello, i'm trying to configure cookieconsent to block Google Analytics, but even if i followed your instructions, the plugin not working correctly. I have verified that the plugin blocks cookies (_ga / _gid / _gat) until the user confirms, but then these cookies do not update their expiration while browsing. After its duration (1 minute) the "_gat" cookie is deleted and no longer reloaded. Consequently, the user's visit is only detected on the first login page.
Locally I have the files: <script type='text/javascript' src='js/cookieconsent.js''>
app.js configuration:
` var cc = initCookieConsent(); cc.run({
current_lang : document.documentElement.getAttribute('lang'), autoclear_cookies : true, theme_css: '/css/cookieconsent.css', cookie_name: 'cookieconsent', cookie_expiration : 182, page_scripts: true,
cookie_same_site: "Lax",
}); `
`
`
Thank you very much