All Collections
Integrations
Analytics
Google Analytics and LaunchNotes
Google Analytics and LaunchNotes

Capture page views with Google Analytics

Michael Simmons avatar
Written by Michael Simmons
Updated over a week ago

Google Tag Manager is a powerful tool that allows website owners to easily manage and deploy tracking tags on their website. With Google Tag Manager, you can capture Google Analytics data and set up page tracking without the need for complex coding. In this article, we will explain how to use Google Tag Manager to capture Google Analytics and page tracking and provide an example script of how to do this.

Step 1: Set up Google Analytics

Before you can start using Google Tag Manager to capture Google Analytics data and set up page tracking, you need to set up Google Analytics on your website. To do this, create a Google Analytics account and follow the instructions to add the tracking code to your website. Once you have added the tracking code, you will be able to view data about the performance of your LaunchNotes page in the Google Analytics dashboard.

Step 2: Set up Google Tag Manager

To set up Google Tag Manager, go to the Google Tag Manager website and create an account. Once you have created an account, you will be given a container code that you need to add to your website. The container code is a small piece of JavaScript that allows Google Tag Manager to manage and deploy tracking tags on your page.

To add the container code to your page, copy and paste it into the header section of your HTML code.

Step 3: Add Google Analytics to Google Tag Manager

Once you have set up Google Tag Manager, you can add Google Analytics to it. To do this, follow these steps:

  1. Go to the Google Tag Manager dashboard and click on the "Tags" menu.

  2. Click the "New" button to create a new tag.

  3. Select "Google Analytics" as the tag type.

  4. Enter your Google Analytics tracking ID.

  5. Set up the tracking options, such as the tracking type (pageview, event, etc.), the trigger (when to fire the tag), and the tag name.

  6. Save the tag.

Once you have added the Google Analytics tag to Google Tag Manager, you can add it to your LaunchNotes page under Look and Feel.

Step 4: Set Up Page Tracking

To set up page tracking using Google Tag Manager, you need to create a new tag and set up a trigger for it. The trigger specifies when the tag should fire, such as when a user clicks a button or submits a form.

Here's an example of how to set up a tag to track page views:

  1. Go to the Google Tag Manager dashboard and click on the "Tags" menu.

  2. Click the "New" button to create a new tag.

  3. Select "Google Analytics" as the tag type.

  4. Enter your Google Analytics tracking ID.

  5. Set the tracking type to "Pageview".

  6. Set up the trigger to fire on "All Pages".

  7. Save the tag.

Once you have set up the tag and trigger, you can deploy it to your website.

Example script:

Here's an example script of how to set up page tracking using Google Tag Manager:

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- End Google Tag Manager -->

<!-- Google Analytics -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

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

Did this answer your question?