1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Xenforo and Google's "Universal Analytics"

Discussion in 'General XenForo Discussion and Feedback' started by ForestForTrees, Nov 21, 2013.

  1. ForestForTrees

    ForestForTrees Well-Known Member

    I just received an email from Google Analytics describing a transition from "Classic Analytics" to "Universal Analytics." Universal Analytics seems to be more "universal" and powerful in that it can track people between different types of devices. It also seems to be the future. I'm not sure what it means for xF admins, though, so I thought it might be good to dedicate a thread to what it means to us. For example, do we need to update any templates? Will this give us any functionality that we actually care about?

    It does seem to be the future for GA. In an article linked to from their newsletter, they write:
    Here's what they say about upgrading:
    The full article is here: http://analytics.blogspot.com/2013/10/an-easy-way-to-upgrade-to-universal_23.html

    It is the "Use the analytics.js JavaScript library on your websites, and Android or iOS SDK v2.x or higher for your mobile apps." sentence that makes me think that it might be nice to have a thread about it.
     
    Jeffin likes this.
  2. Mouth

    Mouth Well-Known Member

    After migrating to Universal, edit template google_analytics, and replace contents with:
    HTML:
    <xen:if is="{$xenOptions.googleAnalyticsWebPropertyId}">
    <!-- 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', '{$xenOptions.googleAnalyticsWebPropertyId}', 'auto');
    ga('send', 'pageview');
    
    </script>
    <!-- End Google Analytics -->
    </xen:if>
    
    Regardless, you need to take note because you will be eventually auto migrated to universal anyways by phase 2 or 3, whether you want to or not.
     
    Deriel, OakleyForum, leksi and 4 others like this.
  3. surfsup

    surfsup Well-Known Member

    Is this still valid with 1.3 ?

    I am upgrading to the
    Universal Analytics tracking code
     
  4. Tracy Perry

    Tracy Perry Well-Known Member

    Use the script sample they give you in your Analytics admin panel and it should work. Does on my 3 forums.
     
    surfsup likes this.
  5. Tracy Perry

    Tracy Perry Well-Known Member

    Also... as additional info. If you use multiple styles, don't forget to update it in EVERY style you use. I forgot to (I offer 5 different styles) after changing my default to a Drift derivative. Just noticed no tracking info was being done and figured out why.
     

Share This Page