1. Home
  2. Web Content
  3. Enabling Google Analytics support

Enabling Google Analytics support


Google Analytics is a free web analytics application provided by Google, including SEO recommendations and live site traffic.

Sample Google Analytics dashboard

Sample Google Analytics dashboard

Setting up GA

Google Analytics can be enabled on newer, v5+ platforms using two lines in a .htaccess file.

  1. Visit Google Analytics to create a profile for the domain
    • Once the profile is created, you will see sample code to insert:
       (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      ga('create', 'UA-99999000-1', 'auto');
       ga('send', 'pageview');
    • Write down your account number, bolded above, which follows the form UA-XXXXXXXX-X
    • It is unnecessary to add the sample code above. This will be added automatically via mod_pagespeed in the following step
  2. Create a file, if it does not exist, named .htaccess in the document root for the domain to enable statistics reporting
  3. Add the following lines:
    ModPagespeedEnableFilters insert_ga
    ModPagespeedAnalyticsID UA-XXXXXXXX-X

    • Where UA-XXXXXXX-X is the account number previously generated by Google
  4. Voila! Wait 24 hours for statistics to generate within Google Analytics’ dashboard

Updated on July 8, 2019

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help! If you get an error, visit https://lithiumhosting.com/support instead.
Contact Support