Thread Starter
Agnes
(@agneslesagegmailcom)
PS: sorry, I had not read FAQS that explainjs:
I need to put this:
if ( function_exists('cookie_accepted') && cookie_accepted() ) {
// Your code
}
Any way to make it compatible with GA plugin?
Hi,
you should place your GA code directly in the theme, or if you have a plugin that support custom edit of ga code, you can use or placeholders to exlude it.
Thread Starter
Agnes
(@agneslesagegmailcom)
Thanks for the response.
If anoyone knows a plugin that does support custom edit of ga code, I’d be glad to know.
in the meantime, I found it works using DuracellTomi Google Tag Manager plugin to call Google Tags (including GA) conditionnally, with this small edit after the body tag that combines instruction of both plugins, :
if ( function_exists('cookie_accepted') && cookie_accepted() )
{ if ( function_exists( 'gtm4wp_the_gtm_tag' ) )
{ gtm4wp_the_gtm_tag(); }
}
Thanks:)
Thread Starter
Agnes
(@agneslesagegmailcom)
Sorry, I have one doubt:
If I use the above function, that activates Google Tag Manager and GA only when cookies are accepted, then GA can’t be activated as soon as the user accepts the policy, right?
Any idea of a workaround..?