WordPress.org

Support

Support » Plugins and Hacks » [Resolved] How to use ga.js

[Resolved] How to use ga.js

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author John Huebner

    @hube2

    ga.js is the older code snippet and looks something like this:

    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-XXXXX-X']);
      _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>

    The new version that is in public beta is analytics.js. The code snippet for it looks something like:

    <!-- Google Analytics -->
    <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', 'UA-XXXX-Y');
    ga('send', 'pageview');
    
    </script>
    <!-- End Google Analytics -->

    At this time, if you have you site set up to use either of them you can’t convert Google Analytics Dashboard to use the other one.

    However, you can set up two properties in you Google Analytics Dashboard and track your site using both types. This is what Google is recommending.

    Here’s an article about it: http://analytics.blogspot.com/2013/03/expanding-universal-analytics-into.html.

    Hope this information helps.

    I have plans to expand this plugin to work with the new tracking script as well as keep it compatible with the current script, I just haven’t gotten there yet.

    Cool I made a new property and linked it to my Blunt GA install.

    I see that in the real time I’m getting page views, but no events. Does it take 24 hours or so for full integration?

    Thanks again, I’m really excited to get this working!

    Plugin Author John Huebner

    @hube2

    Testing now.

    Plugin Author John Huebner

    @hube2

    It appears there is a problem with event tracking, I’m working on a fix for it now. More details here.

    Plugin Author John Huebner

    @hube2

    I have uploaded a new version that should correct the event tracking issue. For more details see the topic about event tracking problem.

    I tried updating the plugin and it crashed my install of wordpress. I renamed the plugin folder to blunt-gabak and it came back.

    I tried installing it fresh and it gave me the following fatal error:

    Warning: require_once(/home2/cnbscene/public_html/wynlv/wp-content/plugins/blunt-ga/tld/utils.php) [function.require-once]: failed to open stream: No such file or directory in /home2/cnbscene/public_html/wynlv/wp-content/plugins/blunt-ga/blunt.ga.class.php on line 4

    I was so pumped to try it! 🙁 Is it something I did wrong?

    I don’t see this directory path in on my server:
    /plugins/blunt-ga/tld/utils.php

    In fact I see no sub directories in either blunt-ga or the backup (blunt-gabak) that I made. There are 2 php files 2 js files a CSS file and some screenshots. That’s it.

    Thanks again!

    Plugin Author John Huebner

    @hube2

    I’m uploading a new version now.

    Between my rush to fix the bug and it being past my bed time I failed to include a required file.

    Looks like its working now! I setup some goals for click to call and mailto.

    The events show immediately in the Realtime

    I’m guessing the conversions and events will start tomorrow when the “Content” section updates.

    Thanks for your quick response and help. I’ve tried every other plugin out there and everyone ignored my concerns.

    You rock!

    Plugin Author John Huebner

    @hube2

    You’re welcome.

    Honestly glad you brought up the problem. We use this for all of our clients and I was unaware that the event tracking had stopped working. It wouldn’t have been till the next review before we noticed it.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] How to use ga.js’ is closed to new replies.