Skip to main content

Google Analytics and Brizy

Completed

Comments

10 comments

  • Sandra Prunici

    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
  • Denise Czichocki

    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 wishes

    0
  • Sandra Prunici

    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
  • Denise Czichocki

    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
  • Sandra Prunici

    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,
    Sandra

    0
  • Denise Czichocki

    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.php

    best wishes
    Jörn

    0
  • Denise Czichocki

    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
  • Sandra Prunici

    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
  • Denise Czichocki

    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
  • Sandra Prunici

    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.