How to Use Google Analytics for Your Blog or Website

Learn how to set up Google Analytics on your blog or website. Track visitors, monitor performance, and optimize your site effectively.

Welcome to EmadulAi! Google Analytics is a powerful tool that helps you track and understand your website or blog traffic. In this guide, we’ll show you step-by-step how to set up Google Analytics, monitor your visitors, and use the data to grow your online presence effectively.

Setup Google Analytics Plugin

Good to know The Google Analytics script will be automatically loaded if your GA4 Measurement ID is set in Blog Settings.

You can either add your Google Analytics 4 Measurement ID through Blog Settings or explicitly set it by finding the following code snippet in Edit HTML and adding your measurement ID.

<Variable name="analytics.accountNumber" description="Google Analytics GA-4 Tracking Code" type="string" default="" value=""/>
[!] Google Analytics GA-4 Tracking Code
[!] @type {String}
[!] If Blank: Tracking Code is added from Blogger Blog Settings
[!] Example: G-0000000H00
<Variable name="analytics.accountNumber" description="Google Analytics GA-4 Tracking Code" type="string" default="" value="G-XXXXXXXXXX"/>
[!] Google Analytics GA-4 Tracking Code
[!] @type {String}
[!] If Blank: Tracking Code is added from Blogger Blog Settings
[!] Example: G-0000000H00

Note that you don't have to add any additional Google Analytics script anywhere in Edit HTML, as it will be automatically added with the measurement ID specified above.

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-XXXXXXXXXX');
</script>

Change Google Analytics Script Loading Behaviour

By default, the Google Analytics script is loaded normally, which may impact PageSpeed Insights performance. To optimize loading, you can switch between different script loading behaviours.

The plugin provides 4 types of script loading: Normal, Defer, Lazy, and Defer + Lazy. Default type is Normal.

Behaviours of these loading types are as follows:

  1. Normal: Loads script normally above </head>. Impacts PageSpeed performance.
  2. Defer: Loads script dynamically after page load. Slight PageSpeed impact.
  3. Lazy: Loads script dynamically on first user interaction; later loads instantly. Minimal PageSpeed impact.
  4. Defer + Lazy: Similar to Lazy, ensures page loads first. Minimal PageSpeed impact.

Using any loading type other than Normal may sometimes delay event tracking. For first-time visitors, Lazy and Defer + Lazy require user interaction. Choose wisely for best Google Analytics tracking.

To switch between loading types:

  1. Go to Theme Designer.
  2. Click on Advanced tab.
  3. Select Plugin: Google Analytics from dropdown.
  4. Change Load Type to 1px, 2px, 3px, or 4px for Normal, Defer, Lazy, or Lazy + Defer respectively.

Disable Google Analytics Plugin

If you prefer to manually add Analytics script or disable automatic loading, you can disable the Google Analytics plugin.

Go to Theme Designer > Advanced > Plugin: Google Analytics and set Enable Script to 1px to disable the in-built plugin.

If disabling the plugin while using AMP, be careful. It’s recommended to use the plugin as it handles both AMP and Non-AMP scripts automatically.

Frequently Asked Questions (FAQs) about Google Analytics

1. What is Google Analytics?

Google Analytics is a free web analytics tool by Google that helps you track and analyze website or blog traffic, user behavior, and performance metrics.

2. How do I set up Google Analytics on my blog?

You can set up Google Analytics by adding your GA4 Measurement ID in Blog Settings or using the Analytics plugin provided by your theme to automatically load the tracking script.

3. What is a GA4 Measurement ID?

A GA4 Measurement ID is a unique identifier (starts with G-) used by Google Analytics 4 to track and collect data from your website.

4. Do I need to add the Google Analytics script manually?

No, if you are using the Analytics plugin and have added your Measurement ID, the script will be loaded automatically. Manual addition is optional.

5. How does Lazy or Defer script loading affect tracking?

Lazy and Defer loading improve PageSpeed performance, but event tracking may be delayed for first-time visitors. Users might need to interact with the page before the script loads.

6. Can I disable the Analytics plugin?

Yes, you can disable it via Theme Designer > Advanced > Plugin: Google Analytics by setting Enable Script to 1px. Manual script addition is then required.

Conclusion That’s all about adding Google Analytics to your Blogger posts. We hope you found this guide helpful and easy to follow. Please feel free to share this article with others. If you face any issues or have questions regarding any step, don’t hesitate to ask in the comment section. Thank you for reading!

About the author

Emadul Tarafdar
Hello guys! My name is Emadul Tarafdar. If you enjoy my content, feel free to follow me on my social media links. Thanks so much for your support!

3 comments

  1. Abul Kalam Dhali
    Abul Kalam Dhali
    Good
    1. Blog Ui Design
      Blog Ui Design
      wow soo essy
  2. Rehan Molla
    Rehan Molla
    Wow very Easy 😀

Join the conversation