Google Analytics code

Spartan

Well-known member
Where do I put the google analytics tracking code described below?


  1. Copy and place the code snippet
    Once you find the code snippet, copy and paste it into your web page, just before the closing </head> tag*. If your website uses templates to generate pages, enter it just before the closing </head> tag in the file that contains the <head> section. (Most websites re-use one file for common content, so it's likely that you won't have to place the code snippet on every single page of your website.)

    For the best performance across all browsers we suggest you position other scripts in your site in one of these ways:
    • before the tracking code snippet in the <head> section of your HTML
    • after both the tracking code snippet and all page content (e.g. at the bottom of the HTML body)
  2. Verify and customize
    Verify that your tracking code contains the correct web property ID for your profile (it should if you copied it from the Profile Settings screen). Double-check that the tracking snippet installed on your website matches the code shown in the profile. For more details on verifying your setup, see Verifying your setup.
    Add any customizations back in using the asynchronous syntax. The Usage Guide and Migration Examples (English only) on Google Code provide many examples of customizations with asynchronous tracking.
*One of the main advantages of the asynchronous snippet is that you can position it at the top of the HTML document. This increases the likelihood that the tracking beacon will be sent before the user leaves the page. It is customary to place JavaScript code in the <head> section, and we recommend placing the snippet at the bottom of the <head> section for best performance.
 
You don't.

It's already included in XenForo, you need only to add your tracking account number in the Admin Control panel.

AdminCP > Options > Statistics & Metrics > Google Analytics Web Property ID > [Enter your account number] [Save]

That's all you have to do to enable Google Analytics on your site.
 
Top Bottom