Support » Plugin: Google Analytics for WordPress by MonsterInsights » 'Demographics and Interest Reports' in Google Analytics

  • Resolved Scott Offord

    (@scottofford)


    In order to get the Demographics (Age/Gender) and Interests (Affinity Categories) to work, Google Analytics is telling me that Tracking code changes are needed.

    GA says: “Your Analytics tracking code does not include the necessary support for the Demographics and Interest reports. Learn more about the simple, one-line, one-time change to your tracking code to add this support.”

    https://support.google.com/analytics/answer/2444872?hl=en&utm_id=ad

    The instructions state that I should change this line from:

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    To:

    ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';

    Does the Yoast GA for WordPress plugin support the new Demographics and Interests reports in Google Analytics?

    What should I do to allow this to work using your plugin?

    I’ve asked this question here too: https://github.com/Yoast/google-analytics-for-wordpress/issues/6

    Scott O.

    http://wordpress.org/plugins/google-analytics-for-wordpress/

Viewing 15 replies - 1 through 15 (of 60 total)
  • I’d love to see this change happen. This will help me a ton with getting remarketing working as well. 🙂

    I would like to know what changes need to be done for this to work

    I tried setting Host ga.js locally:: to http://stats.g.doubleclick.net/dc.js.
    Is this the right way of doing?

    +1 here

    +1 !

    +1

    I’ll add to this request. I’m not sure where to add this particular line either and don’t want to mess up the current settings of the GA for WordPress plugin.

    Has anyone cracked this one yet?

    +1

    Don’t expect an answer. It looks like questions are being answered sicne more than a year ago…

    I know how to use git, but I’m very rusty at it. So, I’d rather someone else take a crack at it.

    Mike, when are you going to commit your edit?

    Scott

    Yes, please make this change. I’d love to start collecting this data!

    I came here to second this feature as well.
    The plugin should allow the option to enable collecting demographics, thus using one or another js tracking script.
    Hope to see this implemented soon.

    Edit the file: google-analytics-for-wordpress/frontend/class-frontend.php

    COPY ALL OF THE TEXT IN THIS FILE AND PASTE IT IN NOTEPAD OR ANOTHER TEXT EDITOR JUST IN CASE YOU MESS UP (so you can revert back to the appropriate code).

    Search for ga.src

    you’ll find this:

    ——————-
    ga.src = <?php
    if ( $this->options[‘gajslocalhosting’] && !empty( $this->options[‘gajsurl’] ) ) {
    echo “‘” . $this->options[‘gajsurl’] . “‘;”;
    } else {
    $script = ‘ga.js’;
    if ( current_user_can( ‘manage_options’ ) && $this->options[‘debug’] )
    $script = ‘u/ga_debug.js’;
    echo “(‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/” . $script . “‘”;
    }
    ?>;
    ———————————

    Change it to:

    ———————————
    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’ : ‘http://www’) + ‘stats.g.doubleclick.net/” . $script . “‘”;
    }
    ?>;
    —————————————–

    Once that’s done, hit “Update File”.

    Go to the Plugin Settings page and Update Google Analytics Settings.

    It will repopulate your site with the new code. Be sure to verify it using Google Analytics.

    You forgot to remove the ‘ssl’ and ‘www’….

    Should be changed to this:

    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://' : 'http://') + 'stats.g.doubleclick.net/" . $script . "'";
    }
    ?>;
Viewing 15 replies - 1 through 15 (of 60 total)
  • The topic ‘'Demographics and Interest Reports' in Google Analytics’ is closed to new replies.