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

XF 1.4 Google Analytics Setup

Discussion in 'XenForo Questions and Support' started by DaveM, Jan 28, 2015.

  1. DaveM

    DaveM Well-Known Member

    I am busy setting this up and have placed the required code into my XF ACP. Now I will be using the analyticstracking.php option but am not sure where this file should sit in my forum folders?
     
  2. Mike

    Mike XenForo Developer Staff Member

    What option is that? If you're wanting to do anything more advanced with analytics, you likely can't use the default system -- you can just put your code in the google_analytics template though.
     
  3. DaveM

    DaveM Well-Known Member

    Ok I was not aware that it should be done that way, thanks

    Do I just add it under what is already there?
     
  4. Mike

    Mike XenForo Developer Staff Member

    Well I'm not clear what you're trying to do exactly.

    In general, I'm mostly just saying that if you're wanting to do anything with GA that is more than just adding your ID via the control panel, you'll need to edit the template. Normally, you'd be replacing the whole thing with the new code you got (presumably from the GA site).
     
  5. DaveM

    DaveM Well-Known Member

    Ok that is what I wanted to know, I remove this and replace it with my GA code

    Code:
    <xen:if is="{$xenOptions.googleAnalyticsWebPropertyId}"><script>
    
        var _gaq = [['_setAccount', '{$xenOptions.googleAnalyticsWebPropertyId}'], ['_trackPageview']];
        !function(d, t)
        {
            var g = d.createElement(t),
                s = d.getElementsByTagName(t)[0];   
            g.async = true;
            g.src = ('https:' == d.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            s.parentNode.insertBefore(g, s);
        }
        (document, 'script');
    
        </script><xen:comment><!--Adapted from http://mathiasbynens.be/notes/async-analytics-snippet--></xen:comment></xen:if>
     
  6. NZWarriors

    NZWarriors New Member

    DaveM are you trying to "verify" your account or actually inserting your tracking code?
     
  7. DaveM

    DaveM Well-Known Member

    I am inserting my tracking code, that look a bit like the code I quoted above
     

Share This Page