Google Analytics and Brizy
CompletedHi,
since a few days my Google Analytics don't register any traffic on my Wordpress page. I think it's since i switched my start page from my old theme to Brizy.
The analytics code is still present in the header.php.
Do you have any idea what can be the problem?
Thanks in advance and best wishes
-
Hi Denise,
Could you please give more details regarding how did you add the Google Analytics code and what theme did you use?
Also, could you try to deactivate Brizy Free and Pro and check if you will start receiving the data?
Best regards,
Sandra
0 -
Hi Sandra,
i used the Exposure Theme (as a Child Theme). And i added the code in the header.php
This is the script:<script>
var gaProperty = 'UA-xxxxxxx';
var disableStr = 'ga-disable-' + gaProperty;
if (document.cookie.indexOf(disableStr + '=true') > -1) {
window[disableStr] = true;
}
function gaOptout() {
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
window[disableStr] = true;
alert('Das Tracking ist jetzt deaktiviert');
}
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');ga('create', 'UA-xxxxxxx', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
This worked fine in the past. I also changed the code, to the original code provided by analytics but this didn't worked either.
Best wishes0 -
Did you try to deactivate the Brizy Free and Pro plugin?
Also, did you add the code using the theme or using the Wordpress options?
Best regards,
Sandra
0 -
Yes i tried to deactivate, but this doesn't help.
I entered the code directly into the header.php via editor.
As soon i switch back the static home page of the WP instance to the "old" start page (build with the Unyson Builder) it's working fine again.
Berst regards
0 -
I'm sorry but it isn't correct to add that code inside the header.php file because when the theme will be updating the code will be removed. If you want to add manually the code, you had insert this code in the functions.php file from the Child theme.
function my_child_theme_wp_head() {
echo
'Insert Your Code Here!';
}
add_action( 'wp_head', 'my_child_theme_wp_head' );
For example:
function my_child_theme_wp_head() {
echo
'<script async src="https://www.googletagmanager.com/gtag/js?id=YourID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(\'js\', new Date());
gtag(\'config\', \'YourID\');
</script>';
}
add_action( 'wp_head', 'my_child_theme_wp_head' );
Best regards,
Sandra0 -
Hi Sandra,
I added it in the header.php of the child theme so i think it will not change by an update.
Will try it with the functions.phpbest wishes
Jörn0 -
Hi Sandra,
Sorry i am not a programmer,
but in the functions.php i only see
<?php if (!defined('WP_DEBUG')) die('Direct access forbidden.');
include_once get_template_directory() .'/theme-includes/init.php';
I pasted the code but that has no effect.
how can i edit this file?
0 -
Hi Denise,
I can suggest an easier way to insert the Google Analytics code, without adding manually the code in the right file.
I recommend to instal this plugin and add the Google Analytics code from there. https://wordpress.org/plugins/insert-headers-and-footers/
Best regards,
Sandra
0 -
Hi Sandra,
that's what i have done finally. Installed a Plugin that has all the functions i need.
Thanks for your help.
Best Regards
0 -
Hi Denise,
Great! I'm happy to hear this! It's my pleasure to help you!
Best regards,
Sandra
0
Please sign in to leave a comment.
Comments
10 comments