WordPress.org

Ready to get started?Download WordPress

Forums

Google Analytics for WordPress
Duplicate GA code on site with plugin (2 posts)

  1. onedevteam
    Member
    Posted 2 years ago #

    Hello, i'm using Google Analytics plugin on my site http://skuvajme.com/.
    I connected it to my account, but there's a problem. Code for GA is duplicated on site.

    When i go to site and "view source" of home page, i see

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

    two times in header...

    Can someone help me with this??

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

  2. MichaelKalo
    Member
    Posted 2 years ago #

    I found I have a similar issue, except the GA code is in two spots, but not duplicated. I guessing this is okay, since its not tracking Pageviews twice..

    <script type="text/javascript">

    var _gaq = _gaq || [];

    _gaq.push(['_setAccount', 'UA-xxxxxxxx']);

    _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>

    <script type="text/javascript">//<![CDATA[

    // Google Analytics for WordPress by Yoast v4.2.3 | http://yoast.com/wordpress/google-analytics/

    var _gaq = _gaq || [];

    _gaq.push(['_setAccount','UA-xxxxxxxx']);

    _gaq.push(['_setCustomVar',2,'post_type','page',3],['_setCustomVar',3,'author','jasmine',3],['_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>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic