Google Analytics by Yoast
[resolved] outputting bad code? (2 posts)

  1. silent0
    Posted 4 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 || [];
    (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);

    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
    Plugin Author

    Posted 4 years ago #

    Don't be silly :)


    is the ending code for the


    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

  • Google Analytics by Yoast
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic