• Hi there,

    I have the Google Analytics plug in which allows me to add the web property id in back end of wordpress.

    However, with the Demographic and Interest reports available from Google Analytics, I need to update the code – yet I can’t see where to do this.

    I have also checked all the header, footer, index, home and page php files and can’t file any ga.src code at all…

    any advice will be appreciated ??

    Cheers,

    Kathy

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter kangelone

    (@kangelone)

    I think I need to update this code:
    var _gaq = _gaq || [];
    _gaq.push([‘_setAccount’, ‘UA-36713432-1’]);
    _gaq.push([‘_trackPageview’]);
    (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘https://www’) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
    })();
    </script>

    To something like:
    ga.src = <?php
    if ( $this->options[‘gajslocalhosting’] && !empty( $this->options[‘gajsurl’] ) ) {
    echo “‘” . $this->options[‘gajsurl’] . “‘;”;
    } else {
    $script = ‘dc.js’;
    if ( current_user_can( ‘manage_options’ ) && $this->options[‘debug’] )
    $script = ‘u/ga_debug.js’;
    echo “(‘https:’ == document.location.protocol ? ‘https://ssl&#8217; : ‘https://www&#8217;) + ‘stats.g.doubleclick.net/” . $script . “‘”;
    }
    ?>;

    2 things; 1) not sure where to find code on site to start with and 2) not sure what changes to make to code (i suspect it’s not simply replacing)

    If you use the same Google Analytics plug-in as I do, you need to change the code within the plugin, not in your .php files.

    Click on ‘Plug-ins’ in your dashboard, find the Google Analytics plug-in, and click the ‘Edit’ button. This will take you to the code page you need to edit.

    The Analytics code I had to replace was much simpler than what you posted, and Google Analytics made it very easy to see which line of code needed replacing. I would double-check the Analytics site before making the change f I were you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Update Google Analytics code with Demographic and interests code’ is closed to new replies.