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

  • PamelaMKramer

    (@pamelamkramer)


    Where in the plugin can we change this????

    To implement Remarketing or GDN Impression Reporting, replace the bold text in this example:

    <script type=”text/javascript”>
    var _gaq = _gaq || [];
    _gaq.push([‘_setAccount’, ‘UA-xxxxx-y’]);
    _gaq.push([‘_trackPageview’]);
    (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;

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

    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
    })();
    </script>
    with the bold text in the example below:

    <script type=”text/javascript”>
    var _gaq = _gaq || [];
    _gaq.push([‘_setAccount’, ‘UA-xxxxx-y’]);
    _gaq.push([‘_trackPageview’]);
    (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;

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

    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
    })();
    </script>

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

Viewing 15 replies - 1 through 15 (of 33 total)
  • I have the same question. The line that should change is the ga.src=:

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

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

    Bob Bacon

    (@bobbacon)

    +1
    This is also discussed here: http://wordpress.org/support/topic/demographics-and-interest-reports-in-google-analytics

    The temporary workaround proposed by kaleholdings in the other thread didn’t work for me or another user.

    I guess we are resigned to wait for Yoast to come out with an update.

    webicycoffee

    (@webicycoffee)

    Also following this.

    webicycoffee

    (@webicycoffee)

    The proposed hack on Yoast’s FAQ did not work for me either.

    Google Analytics didn’t validate after I pointed to that URL at my site either.

    adminTripTrist

    (@admintriptrist)

    I need the fix too.

    S3nd41

    (@s3nd41)

    When is the plug-in going to be updated to support this?

    jbug187

    (@jbug187)

    In the last few days Yoast updated their Google Analytics FAQ to say that the Demographics and Interests reports are not currently supported. Prior to this update the FAQ had a workaround posted, which I had tried, unsuccessfully. Does anyone know if they plan on supporting these reports again at some point?

    adminTripTrist

    (@admintriptrist)

    Is there anyway to delete the outdated code manually? Or maybe someone has a friend who can code who would like to fix all of our sites for us? I have the right code written in, but I just need to get rid of the bad code. (I think that would work.)

    petro

    (@petro)

    +1

    mcg_

    (@mcg_)

    +1
    Keen for a solution also.

    Besthand

    (@soft4fun)

    Modify:
    google-analytics-for-wordpress/frontend/class-frontend.php

    LINE 209 to:
    $script = ‘dc.js’;

    LINE 302 to:
    echo “(‘https:’ == document.location.protocol ? ‘https://’ : ‘http://’) + ‘stats.g.doubleclick.net/” . $script . “‘”;

    arcware

    (@arcware)

    Besthand is close, but has the wrong line numbers. The correct way to make this work is as follows (using version 4.3.3, which is the latest as of this writing):

    1. Use a text editor to open this file -> /plugins/google-analytics-for-wordpress/frontend/class-frontend.php

    2. Line 297 looks like this:

    $script = 'ga.js';

    Replace that with this:

    $script = 'dc.js';

    3. Line 301 looks like this:

    echo "('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/" . $script . "'";

    Replace that with this:

    echo "('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/" . $script . "'";

    That should do the trick.

    Thank you for the help. To be clear I open this file. Change the code as listed above and save the file with the same name. Then zip the file, save it with the same name. Then delete the old plugin and and upload the new file.
    That is what I did – but no luck yet. Anything else we need to do?

    Very useful, thank you.

Viewing 15 replies - 1 through 15 (of 33 total)
  • The topic ‘Demographics and Interest Reports for Google Analytics’ is closed to new replies.