WordPress.org

Ready to get started?Download WordPress

Forums

Google Analytics
How to manually update this plugin (1 post)

  1. Sim2K
    Member
    Posted 7 months ago #

    Go to ..

    http://Your-Web-Site.com/wp-admin/plugins.php

    Find "Google Analytics" and click "Edit"

    Make sure it says ...
    "Editing googleanalytics/googleanalytics.php (active)"

    Look for this code ...

    <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', '<?php echo $web_property_id ?>']);
    _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>

    If you want to use the latest tracking code from Google swap it for this ...

    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    
      ga('create', '<?php echo $web_property_id ?>', 'XXX-Enter your website address here with out the http://-XXX');
      ga('send', 'pageview');
    
    </script>

    Swap "XXX-Enter your website address here with out the http://-XXX" for your website address.

    If you want to stop the the code working for the admin and just for your visitors use this code. It checks to see if you are admin. If you are, it does not run the analytic script and stops you adding counts to your website.

    Before script ..

    <?php
    if ( !is_super_admin() ) {
    ?>

    and after the analytics script...

    <?php
    }
    ?>

    This will all be lost on the next update. Lets hope he adds it into the next update.

    Let me know if this helped.

    http://wordpress.org/plugins/googleanalytics/

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.