WordPress.org

Ready to get started?Download WordPress

Forums

Google Analytics for WordPress
[resolved] outputting bad code? (2 posts)

  1. silent0
    Member
    Posted 3 years ago #

    I haven't had any problems installing this plugin on quite a few sites. Maybe there's just something weird about this instance. I looked at view-source and here is what the output looks like:

    '<script type="text/javascript">//<![CDATA[
    // Google Analytics for WordPress by Yoast v4.1 | http://yoast.com/wordpress/google-analytics/
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount','UA-17233107-11']);
    _gaq.push(['_trackPageview'],['_trackPageLoadTime']);
    (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>'

    Note the funny slashes and brackets right before the closing script tag. After inserting the GA code (copying from Google, not the plugin output) manually into my theme files everything worked fine and the tracking code was verified. (PS - using custom child theme built on the Hybrid Theme, not sure if that is relevant)

  2. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Don't be silly :)

    //]]>

    is the ending code for the

    <![CDATA[

    in the top. There's nothing wrong with that code, it just needs a couple (up to 24) hours to work with Google.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic