WordPress.org

Support

Support » Plugins and Hacks » Google Analytics by MonsterInsights » [Resolved] 'Demographics and Interest Reports' in Google Analytics

[Resolved] 'Demographics and Interest Reports' in Google Analytics

  • 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 - 31 through 45 (of 60 total)
  • I just noticed, I tried with the new Google Universal Analytics profile. This type doesn’t support demographics and interests reports yet afaik. But i changed back to the good old analytics and it still doesn’t work.

    The code snippet provide has an error in it. But that’s because this bug is locate in the source-code of Yoast it’s own plugin

    Check out this version of the GA plugin
    https://github.com/jmslbam/google-analytics-for-wordpress
    It removes the extra semicolon behind the options['gajsurl'].
    It should be $this->options['gajsurl'] . "'";

    You can see the difference here GitHub Pull Request – Adjustment

    I have send the Pull-Request and I hope this works for you all.
    Please let me know

    Marcelo Pedra

    @kent-brockman

    Hello guys, today I find Yoast website have updated the page regarding this plugin and making sure that by now it’s not supporting Demographics and Interests reports:
    http://yoast.com/wordpress/google-analytics/faq/

    Scott Offord

    @scottofford

    As you can see here: https://github.com/yoast/google-analytics-for-wordpress they have fixed the issue with the semicolon in their GIT repository.

    However, the repository on WordPress.org has not been updated since 2013-10-30: http://wordpress.org/plugins/google-analytics-for-wordpress/

    Marcelo Pedra

    @kent-brockman

    @scott Offord: I wasn’t aware of a GIT version. I’ll give it a try in a non-production site and see what happens.
    I’ll let you know if does indeed work.

    Marcelo Pedra

    @kent-brockman

    @scott Offord: well boy, it works!!!!!!
    You can see here a screen capture of my Analytics account approved for Demographics and Interest Reports ๐Ÿ˜€
    https://www.dropbox.com/s/r9mfx77copc6ml1/analytics%20ok.jpg

    In order to install the dev version, you need to download it from:
    https://github.com/Yoast/google-analytics-for-wordpress/archive/master.zip

    Then, go to your WP site and open the official Google Analytics for WordPress plugin page in one tab, or take a screen capture just to remember all the settings… After this, in a separate tab of your browser, goto plugins page, deactivate the plugin, delete it, and in the Add New Plugin page, upload the zip you just downloaded from github. Activate it. Go to its options page. Copy all the settings from the other tab. Save. Go to your Analytics desktop, enable Demographics and Interest Reports. Enjoy!
    ๐Ÿ˜‰

    Today, I sent an angry email to Joost de Valk. I’m very sorry for that since I wasn’t aware of a github dev version available. My best and more sincere apologies ๐Ÿ™‚

    Marcelo Pedra

    @kent-brockman

    Just one question: what to use?

    http://stats.g.doubleclick.net/dc.js
    or
    https://stats.g.doubleclick.net/dc.js

    I guess one should choose one or another depending on what protocol the website is using. That’s what I did. Am I right?

    derekclair

    @derekclair

    Worked great for me, thank you.

    elias.m.khoury

    @eliasmkhoury

    Anybody knows if the dev version will be published soon?

    elias.m.khoury

    @eliasmkhoury

    It worked for me ๐Ÿ˜€
    I updated class-frontend.php manually in the plugin
    I hope this won’t affect the next plugin update…

    Adrian

    @gabberkopf

    Manual edit of the class-frontend.php file worked for me too.

    In theory you can put Javascript in the field for the “Host ga.js locally” option, but there’s a bug in the way google-analytics-for-wordpress saves it’s options, it’s not correctly stripping slashes added by magic quotes, but this can be fixed without editing class-frontend.php. I have this working, as in, it’s printing usable code for GA and correctly inserting the script, but due to some of the output from the Yoast plugin (extra “‘” and “;”) it doesn’t yet Validate with Analytics.

    I created a plugin to filter the ga4wp options: https://gist.github.com/tbartels/7580798

    if ( class_exists( "GA_Admin" ) ) {
        global $ga_admin;
    
        function fix_ga4wp_slashes( $new, $old="" ) {
            return stripslashes_deep( $new );
        }
    
        add_filter( "pre_update_option_{$ga_admin->optionname}",
                "fix_ga4wp_slashes", 10, 2 );
    }

    Which makes it possible to paste in the right-hand side of the “ga.src” but you have to compensate for the quotes in the ga4wp plugin. As I said, this outputs usable code, my headers are correctly including the dc.js script, but the tracking code validation doesn’t seem to parse it correctly.

    Hi,

    has anyone an idea how I would get also the code for enhanced link attribution into the script?

    Thank you
    Tom

    Here’s what I did, and no Demographics and Interests work for me.

    In the Google Analytics for WordPress plugin, http://scott.offord.me/Sz4W (screenshot) – check the checkbox to show the Advanced Settings

    http://scott.offord.me/Szxm (screenshots) – in the text box that says “Host ga.js locally”:
    You have to provide a URL to your ga.js file: enter this URL: http://stats.g.doubleclick.net/dc.js

    Then, click the “Update Analytics Settings ยป” button in the plugin.

    Note, in Google Analytics: http://scott.offord.me/Szpv (screenshot) you’ll have to click the “Skip Validation” button, then the next day or do, you’ll start seeing Demographics and Interest info in your Google Analytics profile.

    Here’s what I did, and no Demographics and Interests work for me.

    In the Google Analytics for WordPress plugin, http://scott.offord.me/Sz4W (screenshot) – check the checkbox to show the Advanced Settings

    http://scott.offord.me/Szxm (screenshots) – in the text box that says “Host ga.js locally”:
    You have to provide a URL to your ga.js file: enter this URL: http://stats.g.doubleclick.net/dc.js

    Then, click the “Update Analytics Settings ยป” button in the plugin.

    Note, in Google Analytics: http://scott.offord.me/Szpv (screenshot) you’ll have to click the “Skip Validation” button, then the next day or do, you’ll start seeing Demographics and Interest info in your Google Analytics profile.

    Can anybody confirm this? What happens if you click the ‘Skip Validation’ button? I’m really hesitant to do that coz of the warning “if you want this account to permanently ignore this warning.”

Viewing 15 replies - 31 through 45 (of 60 total)
  • The topic ‘[Resolved] 'Demographics and Interest Reports' in Google Analytics’ is closed to new replies.
Skip to toolbar