How to add Google Analytics to the Mobile Style

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Carbuff
    Senior Member
    • Dec 2011
    • 251
    • 4.2.X

    [Forum] How to add Google Analytics to the Mobile Style

    Even if you add Google analytics to your website it doesn't work for the mobile style.

    It took me a while to figure this out but I figured it out eventually, should take about 3 minutes to do. You will need to know your Google analytics number (UA-1234567-89).

    Log into your admincp > style manager> (default)mobile style. Then select add a new template.
    For the template name put: headinclude_bottom

    The code: (Don't forget to replace UA-*******-** with your Google analytics number)

    Code:
     {vb:cssfile additional.css}
    {vb:raw template_hook.headinclude_bottom_css}
    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-*******-**']);
      _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')[QUOTE][[/QUOTE]0]; s.parentNode.insertBefore(ga, s);
      })();
    
    </script>
    Last edited by Carbuff; Mon 28 Jan '13, 10:41am.
    My board: Auto Forum powered by vBulletin.
  • joeychgo
    Senior Member
    • Mar 2004
    • 2021
    • 5.6.4

    #2
    and...when/where do you call the template?
    Building my Automotive Forum Network...
    Lincoln vs Cadillac - Mopar Forum - E Body Mopar Forum - B Body Mopar Forum - Pick Up Truck Forum - C Body Mopar Forum - FMJ Body Mopar Forum

    Comment

    • Carbuff
      Senior Member
      • Dec 2011
      • 251
      • 4.2.X

      #3
      Originally posted by joeychgo
      and...when/where do you call the template?
      What do you mean?
      My board: Auto Forum powered by vBulletin.

      Comment

      Related Topics

      Collapse

      Working...