Add Google Analytics to My Site

Google Analytics is a very reliable way to get extensive website visitor information. To use this feature, you will need a Google Analytics account and then add the necessary tracking scripts to your website.

Applying for a Google Analytics Account

First, visit the Google Analytics website to apply for an account. You can use an existing Google account to get access to the Analytics dashboard. Next, you will need to add your website to your Google Analytics account. 

Adding your site to the dashboard will require a verification process. This verification helps Google ensure that you own the website. 

Obtaining Your Google Analytics Tracking Code

Add Google Analytics to My Site, Applying for a Google Analytics Account

The Google tracking code is a short script snippet you must embed in your site code.

Once you’ve verified your website, you can then retrieve the tracking code:

  1. On your Google Analytics account, click the “Admin” link at the bottom left of the display. 
  2. Select an account from the dropdown menu under the “Account” column
  3. Select a property from the dropdown menu under the “Property” column.
  4. Click “Tracking Info > Tracking Cookie” under “Property.”

The final step above will open a screen showing you the tracking code, called “Global Site Tag.”

Using the Google Analytics Tracking Code

Once you have your Google Analytics account set up and have added your website, you need to add the tracking code to the website to begin sending visitor data to Google. This step requires the use of a tracking ID, which is in your Google Analytics account.

There are several ways you can make use of the tracking code. For most conventional websites, this is typically done via the Google Tag Manager or by directly embedding the script within your website code.

Option 1. Google Tag Manager

Google Tag Manager offers an easy way to manage tracking code for multiple websites. Log in to your Google Tag Manager dashboard. Next;

  1. Click “Create Account” and furnish Google Tag Manager with the information requested.
  2. From the dashboard, click on the Container Name you just created.
  3. Click “Add New Tag,” then click the “Tag Configuration” work area.
  4. Select “Google Analytics: Universal Analytics” on the menu that appears.
  5. Select the track type you prefer (such as Pageview).
  6. Select the “Triggering” workspace and choose the events which will enable the tracking tag to work. In this case, the option should be “All Pages.”

Option 2. Embedding Script

How you embed the script will vary depending on the type of website operated.

For HTML Sites:

You can also choose to embed the Google Analytics script directly within your website HTML code. To do this:

  1. Copy the Google Site Tag script from your Google Analytics account
  2. You then need to paste the script in the code ( before the </head> tag) of every page on your website for which you wish to track visitor information. 

For Dynamic Sites

Dynamic websites are those generated on user request by using scripts such as PHP. Adding the script on this type of site is more streamlined since you do not need to embed the entire script on every page – you can use an include function.

  1. Copy the script from your Google Analytics account.
  2. Create a file (e.g., MyGA-Tracking.php) and paste the script.
  3. Add the script to each template page after the <body> tag;

    <?php include_once(“analyticstracking.php”) ?>

For Web Applications

Web applications such as WordPress and Joomla often offer modular features that support Google Analytics. You will generally seek a plugin or extension built for this purpose and install it in cases like this.

Once installed, you only need to provide the extension with your Google Analytics tracking ID, and it will handle the rest for you.

Was this helpful?

What’s your goal today?

1. Find the right Web hosting solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lighting fast

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Fill out the form, and we’ll be in touch.

Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.


Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. Learn how to grow your website in 2024

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

An Exclusive Insiders Look Behind The SEO and Web Development Curtain


Working in the web hosting industry for over 13 years, Rado has inevitably got some insight into the industry. A digital marketer by education, Rado is always putting himself in the client's shoes, trying to see what's best for THEM first. A man of the fine detail, you can often find him spending 10+ minutes wondering over a missing comma or slightly skewed design.