How to Setup Google Analytics with Google Tag Manager

Google Tag Manager code snippets will be pasted into your websites header, and body

[et_pb_section fb_built=”1″ _builder_version=”3.29.3″ custom_padding=”0px||8px|||”][et_pb_row _builder_version=”3.29.3″][et_pb_column type=”4_4″ _builder_version=”3.29.3″][et_pb_text _builder_version=”3.29.3″ header_font=”Playfair Display||||||||” header_font_size=”48px”]

How to Set Up Google Analytics with Google Tag Manager

[/et_pb_text][/et_pb_column][/et_pb_row][et_pb_row column_structure=”1_2,1_2″ disabled_on=”on|on|off” _builder_version=”3.29.3″ overflow-x_last_edited=”off|desktop”][et_pb_column type=”1_2″ _builder_version=”3.29.3″][et_pb_text _builder_version=”3.29.3″ text_font=”Montserrat|300|||||||” text_font_size=”18px” text_orientation=”center”]

SHARE THIS

[/et_pb_text][/et_pb_column][et_pb_column type=”1_2″ _builder_version=”3.29.3″][et_pb_social_media_follow _builder_version=”4.3.2″ text_orientation=”left” custom_margin=”0px|||0px|false|false”][et_pb_social_media_follow_network social_network=”facebook” url=”https://www.facebook.com/DigitallyThrive” _builder_version=”4.3.2″ background_color=”#3b5998″ follow_button=”off” url_new_window=”on”]facebook[/et_pb_social_media_follow_network][et_pb_social_media_follow_network social_network=”twitter” url=”https://twitter.com/ThriveDigitally” _builder_version=”4.3.2″ background_color=”#00aced” follow_button=”off” url_new_window=”on”]twitter[/et_pb_social_media_follow_network][et_pb_social_media_follow_network social_network=”linkedin” url=”https://www.linkedin.com/in/digitally-thrive-410897190/” _builder_version=”4.3.2″ background_color=”#007bb6″ follow_button=”off” url_new_window=”on”]linkedin[/et_pb_social_media_follow_network][/et_pb_social_media_follow][/et_pb_column][/et_pb_row][et_pb_row disabled_on=”off|off|on” _builder_version=”3.29.3″][et_pb_column type=”4_4″ _builder_version=”3.29.3″][et_pb_social_media_follow _builder_version=”4.3.2″ text_orientation=”center” custom_margin=”0px||-27px|0px|false|false” custom_padding=”||3px|||”][et_pb_social_media_follow_network social_network=”facebook” url=”https://www.facebook.com/DigitallyThrive” _builder_version=”4.3.2″ background_color=”#3b5998″ follow_button=”off” url_new_window=”on”]facebook[/et_pb_social_media_follow_network][et_pb_social_media_follow_network social_network=”twitter” url=”https://twitter.com/ThriveDigitally” _builder_version=”4.3.2″ background_color=”#00aced” follow_button=”off” url_new_window=”on”]twitter[/et_pb_social_media_follow_network][et_pb_social_media_follow_network social_network=”linkedin” url=”https://www.linkedin.com/in/digitally-thrive-410897190/” _builder_version=”4.3.2″ background_color=”#007bb6″ follow_button=”off” url_new_window=”on”]linkedin[/et_pb_social_media_follow_network][/et_pb_social_media_follow][/et_pb_column][/et_pb_row][et_pb_row disabled_on=”off|off|on” _builder_version=”3.29.3″ custom_padding=”0px|||||”][et_pb_column type=”4_4″ _builder_version=”3.29.3″][et_pb_text _builder_version=”3.29.3″ text_font=”Montserrat|300|||||||” text_font_size=”18px” text_orientation=”center”]

SHARE THIS

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section][et_pb_section fb_built=”1″ _builder_version=”3.29.3″ custom_padding=”4px||2px|||”][et_pb_row _builder_version=”3.29.3″ custom_padding=”8px|||||”][et_pb_column type=”4_4″ _builder_version=”3.29.3″][et_pb_text _builder_version=”3.29.3″ text_font=”Open Sans||||||||” text_text_color=”#000000″ text_font_size_tablet=”19px” text_font_size_phone=”16px” text_font_size_last_edited=”on|phone”]

Google Analytics has quickly become the most popular analytics tool on the internet.   Used by tens of millions of people, Google Analytics can seem overwhelming at first, but allows your business to track vital data.  Targeting the right audience is important to every business, therefor tracking the data that leads to the right audience is imperative.  This post may help you confirm that it’s set up properly.

If you don’t have it set up, make sure you read the full article. Here’s your complete guide on how to set up Google Analytics quickly for the most accurate reporting possible.

Let’s answer a few basic questions and then go into the step-by-step instructions:

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section][et_pb_section fb_built=”1″ _builder_version=”3.22″ custom_padding=”0|0px|0|0px|true|false”][et_pb_row _builder_version=”3.25″ custom_padding=”0|0px|0|0|false|false”][et_pb_column type=”4_4″ _builder_version=”3.25″ custom_padding=”|||” custom_padding__hover=”|||”][et_pb_text _builder_version=”3.29.3″ header_font=”||||||||” header_2_font=”Playfair Display||||||||” header_2_font_size=”38px” header_2_line_height=”1.3em” header_3_font_size=”26px” custom_margin=”18px|||||”]

How to set up Google Analytics

 

How does Google Analytics work?

What does it track?

[/et_pb_text][et_pb_code _builder_version=”3.7″][/et_pb_code][/et_pb_column][/et_pb_row][et_pb_row _builder_version=”3.29.3″ custom_padding=”0|0px|2px|0px|false|false”][et_pb_column type=”4_4″ _builder_version=”3.25″ custom_padding=”|||” custom_padding__hover=”|||”][et_pb_text _builder_version=”3.29.3″ text_font=”||||||||” text_text_color=”#000000″ custom_padding=”2px||4px|||” text_font_size_tablet=”19px” text_font_size_phone=”16px” text_font_size_last_edited=”on|phone”]

Just now, when this page loaded, a tiny bit of Javascript was triggered. It talked to a few cookies on your device, then it reported back to Google and stored the information in our Google Analytics (GA) account.

[/et_pb_text][/et_pb_column][/et_pb_row][et_pb_row _builder_version=”3.29.3″][et_pb_column type=”4_4″ _builder_version=”3.29.3″][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2019/11/Analytics.png” _builder_version=”3.29.3″ width=”72%” module_alignment=”center”][/et_pb_image][/et_pb_column][/et_pb_row][et_pb_row _builder_version=”3.29.3″ custom_margin=”|auto|-2px|auto||” custom_padding=”23px|||||”][et_pb_column type=”4_4″ _builder_version=”3.29.3″][et_pb_text _builder_version=”3.29.3″ text_text_color=”#000000″ custom_margin=”||-2px|||”]

Analytics tracked the page that was viewed, using these cookies and Javascript.  Technically, it doesn’t track who visited, or what they looked at.  And it won’t know how long they were on the page unless they visit another page, triggering the Javascript again.  

By default, it doesn’t track anything except when pages load.  Which means any “non-pageview interactions” are not tracked unless you use “event tracking.”  There’s a lot that it won’t track. 

For example, Google Analytics won’t track anchor links, or jump text, slideshow advances, dropdown expansions, social media icons and offsite links, video plays, LiveChat interactions, embedded map interactions, filters, scrolling, comments & review submissions, PDF and Word downloads, and the list goes on.  

Although there is a lot it doesn’t know, Google Analytics is still a great FREE tool to track visits and behavior!  So let’s get Google Analytics set up!

[/et_pb_text][/et_pb_column][/et_pb_row][et_pb_row _builder_version=”3.29.3″ min_height=”687px” custom_margin=”-12px|auto||auto||”][et_pb_column type=”4_4″ _builder_version=”3.29.3″][et_pb_text _builder_version=”3.29.3″ text_text_color=”#000000″ header_2_font=”Playfair Display||||||||” header_2_text_color=”#000000″ header_2_font_size=”36px” header_2_line_height=”1.3em”]

1.  Set up Google Tag Manager

 

The Analytics JavaScript needs to be on every page of your website, in the <head> section of the code.

Today, the best way to add (and manage) the code for Google Analytics (and every other tracking tag) is Google Tag Manager.  It allows you to take your website data and sends it to other platforms like Facebook Analytics and Google Analytics.  It also allows you to easily update and add tags to your code without having to manually write code on the back end.  

First, set up a Google Tag Manager account.  

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/google-tag-manager-setup-1024×315.png” _builder_version=”4.2.2″][/et_pb_image][et_pb_text _builder_version=”4.2.2″]

Google Tag Manager is a newer, easier option, that allows you to set up Google Analytics and many more tracking tags on your websites, all in one place.  It is meant to work in tandem with Google Analytics.  Create your new account, typing out your Company Name and then your web address under Container Setup.

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/google-tag-manager-company-setup-1024×526.png” _builder_version=”4.2.2″ custom_margin=”-18px|||||”][/et_pb_image][et_pb_text _builder_version=”4.2.2″ custom_margin=”||-7px|||” custom_padding=”||0px|||”]

‘Note*  You will not be able to set up any ‘/’ subdirectories, you must set this up on the primary domain.  For example, if you have a website installed at Digitallythrive.com/blog, you must put in digitallythrive.com.   The Google Tag Manager will be installed onto only the websites you want to track with GTM.  

Next, accept the Agreements after reading through them, and you will be brought to a page that gives you your Google Tag Manager Code(s).  The first code will be applied into the <head>, and the second one serves as a backup, which will be applied to your <body> tags of your website.

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/Google-tag-manager-copypaste-1024×479.png” _builder_version=”4.2.2″][/et_pb_image][et_pb_text _builder_version=”4.2.2″ custom_padding=”||0px|||”]

IF your website is HTML, some version of Dreamweaver, Adobe Muse, etc.  You will want to install the Tracking codes into your header and body of your index.html, and every other page you have.  For instance, if you have an ‘about-us’ page, you will want to install the code on not only your index.html page, but also ‘example.com/about-us.html’.  

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/gtm-file-manager-1024×474.png” _builder_version=”4.2.2″][/et_pb_image][et_pb_text _builder_version=”4.2.2″]

If you have WordPress, you can simply install the tracking code into your themes header.php file.  You will find this in your file manager.  First, find which theme you are using.  Under the WordPress dashboard, go to ‘Appearance -> Themes’.  The very first one on the top-left should say ‘Activated’.  Now, jump to your websites directory in File Manager or FTP, where you can see the files like index.php, wp-config.php, and the folders such as wp-admin, wp-content, and wp-includes.  Jump into the wp-content folder, and then into Themes.  Jump into your websites Theme folder, the folder name will literally be the name of your Theme you just checked.

Open up your header.php file with editor, and copy/paste the Google Tag Manager code snippet, into the following sections.   First, find <head> in your websites code.  In between of the two tags (<head> and </head>) you will paste the code from Google Tag Manager that reads:  ‘Paste this code as high in the <head> of the page as possible:‘.  Here is an example of how to do this.

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/gtm-code-snippet-1024×469.png” _builder_version=”4.2.2″][/et_pb_image][et_pb_text _builder_version=”4.2.2″]

If your WordPress site uses the Divi Theme, Divi makes it very simple, simply go to your Dashboard.  Scroll down to the bottom left, where you will see ‘Divi’.  Click on Divi, then Theme Options.   From here, find the tab on the top, named ‘Integration’.  From here, paste the code into both the first and second sections.  The part that reads ‘Add code to the < head > of your blog:  paste the top part of the Google Tag Manager Code.  Directly under that, where it reads ‘Add code to the < body > of your blog:  paste the second part of the Google Tag Manager Code.  Simply save changes!

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/gtm-divi-1024×459.png” _builder_version=”4.2.2″][/et_pb_image][et_pb_text _builder_version=”4.2.2″]

You are almost done!  Make sure you actually publish changes, or you will not have activated your Google Tag Manager.  This may lead to no tracking later on.  Once published, follow the next steps.  You will create your Google Analytics account, and if you already have one, I will explain how to add your Tracking Code from Google Analytics to your Google Tag Manager.

[/et_pb_text][et_pb_text _builder_version=”3.29.3″ header_2_font=”Playfair Display||||||||” header_2_text_color=”#000000″ header_2_font_size=”36px” header_2_line_height=”1.3em”]

2.  Set up Google Analytics account

First, you will need to jump over to the Google Analytics website, which can be found at https://analytics.google.com.  This will direct you to a sign in page, so login with whatever Google account that you have.  If you are new to Google, you will need to create an account.  

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2019/11/google-analytics-setup.png” _builder_version=”3.29.3″][/et_pb_image][et_pb_text _builder_version=”3.29.3″]

First, set up your Google Analytics account.  Enter your account and website URL.   Make sure you select the proper time zone to report in, as well as your Websites Industry Category.

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/google-analytics-create.png” _builder_version=”4.2.2″][/et_pb_image][et_pb_text _builder_version=”4.2.2″]

Once you do that, accept all terms in order to get your Tracking ID.

This will be found at Admin (bottom left), once clicked you will see a section for Tracking Info.  Under this you will see Tracking Code, click on that.  

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/analytics-tracking-code-1024×419.png” _builder_version=”4.2.2″][/et_pb_image][et_pb_text _builder_version=”4.2.2″]

You will need this tracking information for Google Tag Manager, which has already been published to your site.  The old, hardcoded way would have you copy/paste this code directly into your site, but now with Google Tag Manager, you can keep a variety of tracking scripts without having to keep adding code to your site. 

[/et_pb_text][et_pb_text _builder_version=”3.29.3″]

3.  Set up analytics tag with Google Tag Manager

[/et_pb_text][et_pb_text _builder_version=”4.2.2″ custom_margin=”||13px|||”]

Now that you have set up both Google Tag Manager, and Google Analytics, you will learn how to set up specific Google Analytics tracking tags for your website.

Go to your Google Tag Manager Dashboard, and click on Add New Tag.

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/gtm-new-tag-1024×457.png” _builder_version=”4.2.2″ custom_margin=”4px|||||”][/et_pb_image][et_pb_text _builder_version=”4.2.2″ custom_margin=”||-6px|||”]

Click on Tag Configuration,  and select Google Analytics: Universal Analytics 

[/et_pb_text][/et_pb_column][/et_pb_row][et_pb_row _builder_version=”3.29.3″ custom_padding=”0px|||||”][et_pb_column type=”4_4″ _builder_version=”3.29.3″][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/gtm-google-analytics-1024×461.png” _builder_version=”4.2.2″][/et_pb_image][et_pb_text _builder_version=”4.2.2″]

Track type is already set to: Page Views.  Under Google Analytics Settings, drop down and select ‘New Variable’. 

[/et_pb_text][et_pb_image src=”https://digitallythrive.com/wp-content/uploads/2020/01/gtm-ga-new-variable-1024×496.png” _builder_version=”4.2.2″][/et_pb_image][et_pb_text _builder_version=”4.2.2″]

Copy and Paste your Tracking ID from Google Analytics into this box, and save changes.  Now your site will be tracking visitors live!  Make sure you whitelist your IP address in your Google Analytics Account.

[/et_pb_text][et_pb_text _builder_version=”3.29.3″ custom_margin=”||10px|||”]

4.  Publish your workspace

[/et_pb_text][et_pb_text _builder_version=”4.3.2″]

The most overlooked step, just a quick reminder that you need to publish your workspace, now that you have created it.  Not doing so will lead to a loss of analytics, loss of tracking data, etc.  If you think you have already published but are unsure, visit your site.

Check the Javascript console by pressing Control + Shift + J (Command + Option + J on Mac).  Check for any references to gtm in the red lettering that shows up as your errors.  404 not found for GET: GET http://www.googletagmanager.com/gtm.js?id=GTM-XXXXX  If you see the Google Tag Manager 404 Not Found error, you have not published yet.

 

To publish your current workspace:

  1. Click Submit at the top right hand side of the screen. The Submit Changes screen will appear, with options to publish the container and save a version of your container.
  2. Select Publish and Create Version if it is not already selected.
  3. Review the Workspace Changes section to see if your configuration appears as you expect.
  4. Enter a Version Name and Version Description.
  5. If you have Tag Manager configured to use multiple environments, use the Publish to Environment section to select which environment you’d like to publish to.
  6. Click Publish.

[/et_pb_text][et_pb_blurb title=”Like what you see? More like this Article:” use_icon=”on” _builder_version=”4.3.2″][/et_pb_blurb][/et_pb_column][/et_pb_row][et_pb_row _builder_version=”4.3.2″][et_pb_column type=”4_4″ _builder_version=”4.3.2″][et_pb_blog fullwidth=”off” show_more=”on” show_categories=”off” show_pagination=”off” masonry_tile_background_color=”#f2f2f2″ _builder_version=”4.3.2″ width=”100%” module_alignment=”center” custom_margin=”|0px||0px|false|false”][/et_pb_blog][/et_pb_column][/et_pb_row][/et_pb_section]

About The Author

Scroll to Top