Home
/
Website Help
/
Other
/
How to add & configure Google Analytics for your website?

How to add & configure Google Analytics for your website?

One of the many great services provided for free by Google is the well-known traffic monitoring feature called Google Analytics.

Google Analytics is a tool that provides a wide range of information regarding your visitors’ physical location, referring websites, unique visitors’ number, content popularity, visitor behavior, measure the effectiveness of online marketing efforts, and gain insights into your audience.

In 2024, Google Analytics 4 (GA4) focuses more on event-based tracking and cross-platform data analysis (websites and apps).

A lot of useful tools are provided for traffic optimization. For example, a world map with the exact location of your visitors is available which is an important feature for any webmaster whose website is local-market oriented. Additionally, the Traffic Sources feature allows you to closely monitor the number of visitors any website refers to you. This can be of great importance if, for example, you are in the middle of a paid Internet/Banner-based advertisement campaign because you will be able to determine which website is worth continuing your banner advertisement with.

Even with all those great features and complex data mining, Google Analytics is one of the most user-friendly tools.

How to configure Google Analytics for your website?

  1. Sign Up/Log In:
    • You still need to sign up or log in to Google Analytics to create an account.
    • If you are new, the default setup will now guide you towards setting up Google Analytics 4 (GA4), rather than Universal Analytics (UA).
  2. Add Your Website (Property) and Set Up Data Stream:
    • After logging in, you will create a new property by clicking “Admin”, then under the Property column, click “Create Property”.
    • In GA4, properties represent your website, and you will also set up a data stream to collect data from your website (or mobile app).
    • You will enter your website URL and configure basic settings like Time Zone and Currency.
    • Time zone selection is still important to ensure your analytics reports align with your business hours.
  3. Generate and Install the Tracking Code:
      • After creating the property, you’ll be guided to set up a Web Data Stream.
      • GA4 no longer uses the old-style UA-xxxxxx-x tracking ID but instead uses measurement IDs that look like G-XXXXXXX. You’ll see this under Data Stream Settings.
      • The tracking code you are now provided with will look like this:
        <!-- Google Analytics -->
        <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
        <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', 'G-XXXXXXX');
        </script>
      • This code must be added to your website in the <head> section of every page, rather than at the bottom (as in older versions). This is because the script runs asynchronously, meaning it won’t slow down the page load.
  4. Installing on WordPress or Other Platforms:
    • For WordPress or similar platforms, you no longer need to manually paste the tracking code everywhere. Plugins like “Site Kit by Google” or MonsterInsights allow easy integration.
    • You can install the plugin, connect it to your Google Analytics account, and it will automatically place the correct tracking code on all pages for you.
  5. Installing on Custom Websites (PHP, HTML, etc.):
    • If you have a static HTML or PHP website, you still need to manually add the tracking code to the <head> section of each page.
    • However, if your website uses a common header or footer file (e.g., through a PHP include or HTML template), you can simply add the tracking code there so that it appears on every page.
  6. Verification:
    • After setting up the tracking code, verify the installation by checking the “Real-time” reports in your Google Analytics dashboard. You should see live data if everything is configured correctly.
    • You can also use tools like Google Tag Assistant or browser developer tools to ensure the script is correctly loading on your site.

While Google Analytics provides powerful insights on its own, for more customized GA4 reporting capabilities, considering a dedicated GA4 reporting tool can significantly enhance your data analysis and decision-making process. These tools are designed to help you create bespoke reports tailored to your specific KPIs, combining Google Analytics 4 data with other sources for a comprehensive overview.

On the other hand, if you are using any open-source application you may search on the official website for a suitable module/component that can help you insert the code. Below is a list of some of the most commonly used applications for which you can find such components or instructions on how to add your code:

  • WordPress:

GA Google Analytics

Google Analytics for WordPress

Note: Depending on your WordPress theme, one of the plugins may not work properly; thus we recommend trying both of them and then checking which one is properly detected by the Google Analytics tool.

 

The article was last updated on 23.10.2024

Share This Article