Analytics – Training + Tools
(tag manager and gtag.js together)


other stuff first

Cross domain measurement (gtag.js developer documentation)
https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain

gtag.js Developer Guide
https://developers.google.com/analytics/devguides/collection/gtagjs/

Set up reporting views and add filters

By default, Analytics only includes the page path and page name, not the domains name. For example, you might see your pages appear in the Site Content report like this:

  • /about/contactUs.html
  • /about/contactUs.html
  • /products/buy.html

Because the domain names aren’t listed, it might be hard to tell which domain each page belongs to.

To get the domain names to appear in your reports you need to do two things: Create a copy of your reporting view that includes data from all your domains in it and add an advanced filter to that new view. The filter will tell Analytics to display domain names in your reports.

Follow this example to set up a view filter that displays domain names in your reports when you have cross domain measurement set up. For some fields, you need to select an item from the dropdown menu. For others, you need to input the characters here:

  • Filter Type: Custom filter > Advanced
  • Field A –> Extract A: Hostname = (.*)
  • Field B –> Extract B: Request URI = (.*)
  • Output To –> Constructor: Request URI = $A1$B1

Click Save to create the filter.

You can validate that filters are working as you expect using Google Tag Assistant Recordings. Tag Assistant Recordings can show you exactly how your filters change your traffic.

Add domains to the Referral Exclusion List

When a user journey crosses from your first domain to your second domain, Analytics interprets that as the user having been referred by your first domain to your second domain, and Analytics creates a new session. If you want to be able to measure a single session across multiple domains, you need to add your domains to the referral exclusion list.

Check that cross-domain measurement Works

The best way to validate that cross-domain measurement is set up correctly is to use Google Tag Assistant Recordings. When you make a session that crosses domains, it can tell you instantly whether it worked or not.

Here’s an example Tag Assistant Recordings report that shows what it looks like when cross-domain measurement is not setup properly.

Related resources

analytics.js

gtag.js


https://stackoverflow.com/questions/33106189/send-ga-events-using-onclick-event


https://www.analyticsmania.com/post/google-analytics-settings-variable/
https://www.analyticsmania.com/post/google-analytics-and-google-tag-manager-naming-conventions/

Debug Messages

1. DEBUG LINK: https://tagassistant.google.com/#url=https%3A%2F%2Fnakedsword.com%2F

2. https://tagassistant.google.com/#url=https%3A%2F%2Fnakedsword.com%2F

  1. https://support.google.com/tagassistant/answer/3207128?ref_topic=2947092#nonstandard

    — checked with preview https://support.google.com/tagmanager/answer/6107056?visit_id=637395426297878145-3967081554&rd=1 – info is being passed.

  2. multiple gtm –

    — this is a bug in the testing software

    Multiple installations of Google Tag Manager detected by Tag Assistant: What to do?



    — 1 is the tag 1 is the test debugger


tracking video

https://knowledge.vidyard.com/hc/en-us/articles/360010001653-Track-video-views-with-Google-Tag-Manager

Google Tag Manager Video Tracking Guide: Beyond Youtube


Built-in variables for web containers

https://support.google.com/tagmanager/answer/7182738?hl=en


keep em separated

You can still create a Universal Analytics GTM Tag that fires on all pages, but instead of selecting Track Type: “Page View”, you select “Event”. Therefore, instead of having duplicate pageviews (one fired from each GA and GTM), you would have an event tracked called “Page View” which would feed into the Behavior section of GA.

One tracker name for all of it

https://www.simoahava.com/gtm-tips/be-careful-with-the-tracker-name-setting/#tip-41-one-tracker-name-to-rule-them-all


setting up cross domain – gtag.js

THIS ONE IS THE BEST:: (older have to update but solid)

https://developers.google.com/gtagjs/devguide/linker

https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain

https://support.google.com/analytics/answer/1034342?hl=en


https://support.google.com/tagmanager/answer/7582054?hl=en


mess for the future if they don’t move off gtag.js

https://developers.google.com/analytics/devguides/collection/ga4/basic-tag?technology=gtagjs


together

Can You Have “Regular” Google Analytics and Google Tag Manager at the Same Time?


So the question we want to answer today is, “Can You Have “Regular” Google Analytics and Google Tag Manager at the Same Time?” The simple answer is….

Yes You Can…

[Short answer]: Yes you can – just don’t fire a Page View tag via Google Tag Manager.

AKA, don’t set up this in GTM:

…But should you?

[Opinion alert]: Probably not. It can be fine. It can also be problematic, depending on how you have things set up. We’ve seen our fair share of messy analytics implementations, often caused by layers of analytics methods, whether that’s via WordPress analytics plugins, CMS configurations, weird copy and paste mix-ups, etc. Let’s explore!


How to make GA + GTM work

SETTING HERE:

– modern update

developers.google.com/tag-manager/enhanced-ecommerce

Let’s say you want to have some of the advanced functionality that the Universal Analytics Google Tag Manager provides (such as enabling cross-domain tracking – see Tip #10), but you have the hardcoded GA code on your site. Here’s a simple workaround we’ve developed for sites that ultimately require both GA and GTM for comprehensive advanced analytics tracking (Shopify, I’m looking at you).

You can still create a Universal Analytics GTM Tag that fires on all pages, but instead of selecting Track Type: “Page View”, you select “Event”. Therefore, instead of having duplicate pageviews (one fired from each GA and GTM), you would have an event tracked called “Page View” which would feed into the Behavior section of GA.

Here’s what that might look like:

GA + GTM = Maybe

Having both hardcoded Google Analytics and Google Tag Manager on your site in and of themselves is not an issue. You’ll ultimately need to make sure you’re not duplicating your efforts and consequently duplicating your data. If you need to have both, then yes, you can. If you don’t, then no you shouldn’t. By simplifying your implementation, you get to take advantage of achieving excellent business buzzwords like ‘scalable’ and ‘seamless’.

Speaking of ‘seamless’, are you ready to switch to Google Tag Manager?


https://www.simoahava.com/analytics/ga-snippet-and-ga-gtm-tag-on-the-same-page/

https://www.simoahava.com/gtm-tips/be-careful-with-the-tracker-name-setting/

Hi Simo, Excellent article!

Is it possible to override the analytics.js pageview with GTM pageview? I have an existing analytics.js snippet on a site that I can not edit. I can only add a new GTM container. I want to start pushing the clientId to a custom dimension. Will creating a new GTM pageview tag (with same tracker name and domain) override the pageview pushed by the analytics.js snippet?

Simo Ahava

No, there’s no concept of “override” in GA. If the analytics.js snippet has time to send the pageview (as it almost certainly does) before GTM is loaded, it will send the pageview. But you can simply send the Client ID with an event instead. If the custom dimension is in session- or user-scope, it will apply to the pageview hit sent from the page as well.


I’m using GTM for the event listeners and GA tracking on the rest of the site, however plan to write inline events and pageviews for Enhanced eCom on the cart of the products portions of the site.

Obviously there’s a lot more information that you need, but on the face of it, do you see any obvious problems that I’m missing?

Thank you for any response and it was also great hearing you at Measure Camp last year!

Shadi

Anonymous

No, I don’t see any issues, providing you make sure the trackers that need to share settings do so. That’s really all that matters. GTM and GA can coexist quite nicely as long as you either 1) share the settings if you want both tracking methods to track to the same UA-XXXXX-Y, 2) have different settings (esp. tracker name) if you want both tracking methods to track to different UA-XXXXX-Y.

Any deeper / more insightful analysis would require further information.

the only article about the 2 together.
>Note: You should not use the custom HTML tag option to deploy gtag.js-based tags. Instead, use Tag Manager’s native tag templates for Google Ads, Analytics, and Floodlight.


This snippet loads the gtag.js library, establishes GA_MEASUREMENT_ID as the default Google Analytics property ID, and sends a pageview hit to Google Analytics.

Disable pageview measurement
The default behavior of this snippet is to send a pageview hit to Google Analytics. This is the desired behavior in most cases; pageviews are automatically recorded once you add the snippet to each page on your site. However, if you don’t want the snippet to send a pageview hit to Google Analytics, set the send_page_view parameter to false:

[code language=”php”]gtag(‘config’, ‘GA_MEASUREMENT_ID’, { ‘send_page_view’: false });[/code]

why tag manager is better – and I wish they set that up

https://improvado.io/blog/google-analytics-and-google-tag-manager

GTAG.js breakdown

Google Analytics: From analytics.js to gtag.js

setting up tag manager to deploy google analytics

https://support.google.com/tagmanager/answer/6107124?hl=en&ref_topic=6333310
– how does this work with the fact that rocketgate still insists on using gtag.js?

https://www.google.com/search?q=using+gtag.js+for+cross+domain+tracking+-+can+I+install+tag+manager&oq=using+gtag.js+for+cross+domain+tracking+-+can+I+install+tag+manager&aqs=chrome..69i57.13375j0j7&sourceid=chrome&ie=UTF-8


GTM Setup CHecklist

[3d-flip-book mode=”fullscreen” id=”106404″ ][/3d-flip-book]


Learn Analytics

https://analytics.google.com/analytics/web/?authuser=0#/a856518w1474421p205517671/report/discover


From the gtag.js Developer Guide:

If you are already using Tag Manager, you should continue to do so. If you don’t need a tag management system, it is fine to use the gtag.js tracking codes provided by each product.

Tag Manager and gtag.js are built on the same infrastructure, and should work properly if deployed on the same page.

The Global Site Tag (gtag.js) is a new way of using analytics.js together with other Google products like AdWords or DoubleClick.
In fact, gtag.js loads up the same old analytics.js next to other libraries depending on what services you configure. In case you configure it with an AdWords account with gtag('config', 'AW-XXXXXXXX-X');, the script will automatically load up conversions.js too. Moreover, gtag.js also does some basic initialization of the services, e.g. triggers a pageview hit for Analytics or a remarketing hit for AdWords.

That being said, it is a bit like a tag manager indeed. However, it works only with Google products. So it is more of a simplification of configuration of the various Google tags by wrapping all of them into a single one.

It is important to note that if you are setting up a new Analytics account, you get the tracking code in the Global Site Tag format! You have no choice.

On the other hand, Google Tag Manager, like most tag management systems, enables you to manage tags beyond the Google suite of products. It comes with a user interface, version control, access management and all the other fancy things. Like analytics.js was, gtag.js is just another JavaScript library with which Tag Manager can communicate.

MORE

https://support.google.com/tagmanager/answer/6107124#settings_variables

Deploy Universal Analytics with Tag Manager

Note: This article is about Universal Analytics. If you are using the next generation of Google Analytics, refer to the Google Analytics 4 documentation.

To set up a new Universal Analytics tag:

  1. On the Workspace Overview screen, click New Tag. Or from anywhere in your container, click Tags > New. A new tag definition screen will appear.
  2. Click Tag Configuration and choose Universal Analytics.
  3. Select the desired Track Type. (For example, use Page View on a website to measure which pages your users visit. Use Event if you want to measure a specific interaction, such as a button click on a promotion.)
  4. Select or create a new Google Analytics Settings Variable:
    • To reuse a Google Analytics Settings Variable that has already been set up:
      1. Select the desired variable from the menu. Your Google Analytics ID and all other settings from that variable will be applied to your tag.
    • To set up a new Google Analytics Settings Variable:
      1. Select New Variable…
      2. In the Variable Configuration screen, enter your Google Analytics ID.
      3. Cookie Domain: If you have no other Google Analytics tags deployed on your site via analytics.js or from Tag Manager, you should leave this value set to “auto“. If you have other Google Analytics tags setup on your site or in Tag Manager, you should confirm that the Cookie Domain value is consistent.
      4. If you require additional settings such as setting custom fields, custom dimensions, custom metrics, content groups, display advertising features, Enhanced Ecommerce features, or cross domain measurement, click More Settings and configure the relevant fields.
      5. Click Save.
      6. You will be prompted to rename the variable if you have not done so already. You may opt to choose to accept the default setting or enter a name of your own. Click Save to complete the tag setup.
  5. If required, configure your tag to dynamically disable Advertising Features or Advertising Personalization.
  6. Click Triggering to choose a trigger that will make the tag fire. You may select an existing trigger, or click the + icon to define a new one.

Tag implementations

Some examples of the possible Google Analytics tag configurations that can be set up from Tag Manager include:

  • Basic web page activity: This is the most common implementation of Google Analytics. Set Track Type to “Page View”, and in the Triggering section select a trigger that will fire on all pages.
  • Measure events: You can use Tag Manager to configure and deploy Google Analytics tags that will measure specific events, such as clicks on links or buttons on a web page. Learn more.
  • Measure activity across domains: Use Tag Manager to understand user activity across multiple domains. Learn more.
  • Ecommerce: Measure ecommerce usage.
  • Dynamic remarketing: Implement dynamic remarketing with Google Analytics to show your users ads that contain products and services that they previously viewed.

Configuration settings for Universal Analytics tags

Google Analytics tags can be configured within Google Tag Manager to have the same functionality as most manual code implementations. (Note: custom Universal Analytics plugins are not currently supported in Tag Manager). Configuration settings are found in the Google Analytics settings variable configuration, or can be set at the tag level in Enable overriding settings in this tag > More Settings:

Fields to set: Use the +Add Field button to create field name/value pairs.

Custom Dimensions: Use the +Add Custom Dimension button to add custom dimensions. Provide an Index and Dimension Value for each entry. Learn more about using custom dimensions.

Custom Metrics: Use the +Add Custom Metric button to add custom metrics. Provide an Index and Metric Value for each entry. Learn more about using custom metrics.

Content Groups: Use the +Add Custom Content Group button to add custom content groups. Provide an Index and Content Group for each entry. Learn more about using content groups.

Enable Display Advertising Features: Enables the displayfeatures plugin for advertising features such as Demographics and Interest Reports, Remarketing, and Google Marketing Platform integration. Note that you must also configure the corresponding settings in the Google Analytics interface, and enabling this feature in your tags is optional. To override this field and the property settings to turn off Advertising Reporting Features, under Fields to set, add a field titled allowAdFeatures and assign it a value of false. Learn about display advertising features and their impact on your privacy policy.

Enhanced Ecommerce: Send data that measures ecommerce-related interactions such as when customers have added items to their orders, when they have started the checkout process, and when they have completed a purchase. You can use enhanced ecommerce to identify segments of customers who fall out of the ecommerce funnel. Learn more

Cross Domain Tracking: Measure separate, top-level domains as a single entity to combine data for those domains together in the same Google Analytics reports. Learn more about cross domain measurement. Additional options include:

  • Auto Link Domains: Enter a comma-separated list of domains to automatically share a client ID across multiple domains.
  • Use Hash As Delimiter: Use an octothorpe (#) instead of a question mark (?) to append cookie values to URLs. Set this value to true, false, or to a Tag Manager variable that returns either true or false.
  • Decorate Forms: Adds measurement information to the form action. Set this value to true, false, or to a Tag Manager variable that returns either true or false.

Advanced Configuration: These controls provide extended functionality and should be used by experienced users only.

  • Global Function Name: Rename the global function used by the Universal Analytics Tag. Learn more.
  • Use Debug Version: Google Analytics provides a debug version of the analytics.js library that logs detailed messages to the JavaScript console. Set this value to true, false, or to a Tag Manager variable that returns either true or false. Learn more
  • Enable Enhanced Link Attribution: Enhanced Link Attribution improves the accuracy of your In-Page Analytics report. When a page contains multiple links to the same URL, it adds a unique element ID to each link. Set this value to true, false, or to a Tag Manager variable that returns either true or false. Learn more
  • Set Tracker Name: Use of named trackers is highly discouraged in Tag Manager. Learn more

optimize settings to control what sends page views

https://support.google.com/optimize/answer/7513085

https://support.google.com/optimize/answer/6314801?hl=en&ref_topic=6197443


  1. 29 gtm tips

  2. Ecommerce Tracking in Google Analytics – Tutorial
  3. Event Tracking via Google Tag Manager – Tutorial
  4. Event Tracking in Google Analytics – Tutorial
  5. Guide to Google Analytics Store Visits Tracking
  6. Offline Conversion Tracking in Google Analytics – Tutorial
  7. Implementing E-Commerce Tracking via Google Tag Manager
  8. Tracking Virtual Pageviews in Google Tag Manager – Tutorial
  9. YouTube Video tracking via Google Tag Manager
  10. How to Use Keyword Hero to Reveal Not Provided Keywords in Google Analytics
  11. Virtual pageviews in Google Analytics – Tutorial
  12. Google Analytics and YouTube Integration Tutorial
  13. Google Analytics for Facebook Tutorial
  14. Google Analytics Cross Domain Tracking Explained Like Never Before
  15. Using multiple Google Analytics tracking codes on web pages
  16. The one thing that you don’t know about PayPal.com and the referral exclusion list
  17. Calculated Metrics in Google Analytics – Tutorial
  18. Creating your own Google Analytics Tag Auditing System
  19. Tracking Site Search without Query Parameter in Google Tag Manager
  20. Tracking true referrals in Google Analytics when using PayPal and other payment gateways
  21. Phone Call Tracking in Google Analytics and Beyond
  22. Learn to Track Qualified and Won Leads in Google Analytics
  23. Introduction to Postbacks in Google Analytics
  24. Google Analytics Recurring Revenue and Subscriptions Tracking Tutorial
  25. How to track the impact of cookie consent on website traffic in Google Analytics
  26. Tracking Offline Conversions in Google Ads
  27. Implementing Scroll Tracking via Google Tag Manager
  28. Scroll Tracking via Scroll Depth Trigger in Google Tag Manager
  29. Site Search Tracking In Google Analytics Without Query Parameters
  30. Video Tracking via YouTube Video Trigger In Google Tag Manager
  31. How to Correctly Measure Conversion Date & Time in Google Analytics
  32. Google Analytics Social Tracking – Twitter, Facebook, Google Plus and LinkedIn
  33. Google Analytics Cross Domain Tracking (ga.js)
  34. Tracking Twitter and Linkedin Social Interactions in Google Analytics
  35. Creating Content Group in Google Analytics via tracking code using gtag.js
  36. Tracking Site Search in Google Analytics with Query Parameters
  37. Understanding site search tracking in Google Analytics
  38. Creating and Using Site Search Funnel in Google Analytics
  39. Learn to Setup Facebook Pixel Tracking via Google Tag Manager
  40. Setting up & Tracking AMP Pages in Google Analytics
  41. Setting up Sales Funnel across websites in Google Analytics
  42. Regular Expressions (Regex) for Google Analytics & Google Tag Manager – Tutorial



A very simple tag to add / test

https://blog.hubspot.com/marketing/google-tag-manager-guide

Collecting data using tools like Google Analytics is critical for expanding your business’s online reach, converting leads into customers, and optimizing a digital marketing strategy to create stronger relationships with your audience.

However, collecting data is easier said than done. Google Analytics and other similar analytics tools aid the process, but they work more effectively with the addition of tags.

What are Google tags?

Tags, in a general sense, are bits of code you embed in your website’s javascript or HTML to extract certain information.

For marketers, necessary tag information typically includes how long users visit a page on your site, form submissions, how they arrived on your site, which links they clicked, or even what products they removed from their shopping cart.

Each tag tracks something different. For instance, you might create a tag just to see how many people fill out the form on your “Contact Us” page. That tag can then send more precise information to Google Analytics, or AdWords, or another third party.

Unfortunately, manually coding tags can be a tedious and difficult process for marketers without much development or coding experience, and it’s time-consuming to fill out tickets for the IT department.

With Google Tag Manager, your whole tagging process becomes much easier. All you do is embed a code into your site pages once, and then each time you want to create a tag, Google Tag Manager codes it and embeds it for you.

Google Tag Manager does a few things: first, it allows your developers and IT department to focus on bigger-picture tasks by eliminating the burden of coding each individual marketing tag.

Second, since Google Tag Manager codes the tags for you, it significantly reduces the possibility of human error.

And third, Google Tag Manager enables your marketing department to take complete control over the tags they create and monitor. Giving your marketers full reign over their tags increases efficiency. Plus, using tags improves the accuracy of your analytics system, guaranteeing higher-quality reports and a better sense of your true online audience.

With all that said, it’s still a tool you might want to try for yourself before deciding if it’s a perfect fit — perhaps you already have a tagging system in place, or you don’t feel you need that level of organization, since your website doesn’t usually need new tags.

Google Tag Manager is free, so you can try it out virtually risk-free. Here, we’ll show you how to set up an account, how to create a new tag, how to use Google Tag Manager with your Google Analytics account, and how to embed the tool in WordPress.

After that, you can decide for yourself if it’s the right system for your business.

How to Set Up Google Tag Manager

Set Up an Account

Setting up a free account is an easy two-step process, but it’s separate from any of your other Google Analytics or Gmail accounts. To ensure a painless set-up for you, we’ve recorded our process for setting up an account.

Here’s what you do:

1. Sign up for an account.

Go to the and click the green “Sign Up for Free” button. It will ask you to input your account name (company), country, and website URL, as well as where you want to use Google Tag (web, iOS, android, AMP). When you’re finished, click the blue “Create” button.

Sign up for Google Tag Manager

2. Follow the coding instructions.

Next, you’ll be given codes and instructions to include one code high in the <head> of your page, and the other after the opening <body> tag. You can do this now, or apply the codes to your site later (they are accessible in your dashboard). Once you’re done, click “Ok”. 

Google Tag code instructions and codes

Set Up a Tag

Once you have a Google Tag Manager account, the first thing you’re going to want to learn is how to set up a tag.

You can create unlimited configurations of tags in Google Tag Manager.

This is helpful for creating in-depth reports on your audience’s behavior, but it can become inefficient if you don’t organize your tags properly.

Google recommends using the following naming convention: tag type – name of app – detail.

Perhaps you name one tagging configuration, “AdWords conversions – iOS – 2018-02 campaign” and then another, “Google Analytics – CTA – About Us page”.

This way, you can correctly identify and collect data related to specific campaigns or pages.

For instance, the second tag, “Google Analytics – CTA – About Us page,” tells you how well your About Us call-to-action button is performing. That information is valuable, and might be lost if you named your tags more generally, like, “CTA button”.

Now that we’ve cleared that up, let’s check out how to set up a tag:

1. Create a new tag in the Google Tag Manager dashboard.

Within your Google Tag Manager dashboard, click the “Add a New Tag” button, circled below in red.

Google Tag Manager dashboard

2. Configure your tag.

Title your tag, and then click anywhere in the top “Tag Configuration” box, to choose a tag type.

Tag configuration screen in Google Tag Manager

3. Choose a tag type.

There are dozens of tag types (they are not all displayed here, and you can also customize a tag type). I chose “Classic Google Analytics”.

 

Google Tag types

If you want your tag tracked in Google Analytics, the next step will be to input your Web Property ID, found in your Google Analytics account. Then, select a “Track Type”. I chose “Page View”, but there are plenty of other options.

Google Analytics tracking in Google Tag Manager

5. Choose a trigger to determine when the tag is recorded.

Next, choose a trigger (a trigger means when you want the tag recorded, i.e. “every time someone visits the page”). I chose “All Pages”, to get insights every time someone views any of my web pages, but this varies depending on your purposes. 

Set up a tag trigger in Tag Manager

6. Save your tag.

When you’re happy with the information in the “Tag Configuration” and “Triggering” boxes, click the blue “Save” button. 

Save your tag in Google Tag Manager

7. Activate your tag by pressing “Submit.”

Next, click the blue “Submit” button. Your tag won’t work until you do so.

Submit your Google Tag Manager tag

When you click “Submit”, you’ll be taken to this “Submission Configuration” page. There are two options: “Publish and Create Version” or “Create Version”. Since I’m ready to push the tag onto all my site pages, I selected “Publish and Create Version”, and then I pressed the blue “Publish” button in the top right.

publish your tag

8. Add a name and description to your tags to keep them organized.

Finally, you’ll be shown this “Container Version Description”. To keep your tags organized, add a name and description to understand what you’re trying to record with this tag.

Add a name and description to your Google Tag Manager Tags

9. Ensure your tag appears in your “Version Summary” report.

Version summary report on Google Tag Manager

Now, you’ve successfully created your first tag.

Google Tag Manager and Google Analytics

If you want to use Google Tag Manager in conjunction with Google Analytics, there are a couple steps you need to take. However, it’s a worthwhile endeavor — embedding tags in your site will increase the precision of your Analytics reports.

First off, you’ll need to remove your GA code from your site pages. You’ll only need your Google Tag Manager tag code embedded — if you use both, it’ll just report everything twice and mess up your data.

Second, you’ll probably want to create a variable for your Google Analytics Tracking ID. A variable is a Google Tag Manager tool meant to increase your efficiency by saving additional (optional) data you provide.

If you save your GA Tracking ID as a variable, you won’t have to look it up every time you create a new tag for Google Analytics (which makes the lazy-person in me very happy).

How to Create a Variable in Google Tag Manager

1. Click “Variables” on your Google Tag Manager homepage. 

Variables in Google Tag Manager

2. Under “User-Defined Variables”, click “New”.

User Definition in Google Tag Manager

3. Name your variable.

I named it “GA Tracking ID” so I’d remember. Then, click the “Variable Configuration” box.

Name your variable

4. Pick a variable type.

Choose “Constant” as your variable type, since you don’t want the ID to change for different tags.

Choose your variable type.

5. Save your settings.

Now, input your Google Analytics Tracking ID number into the “Value” box, and then select “Save” in the top right.

Save your variable.

Next, let’s edit our “TestTag1” that we created earlier in this post, and include the new variable you just created.

How to Edit a Tag and Change its Value

1. Choose a tag to edit.

Back on your homepage, select “Tags” from your side bar. Click on the tag you want to edit (I clicked “TestTag1”).

Choose a tag to edit.

2. Click the grey “+” icon beside the “Web Property ID” box.

gray plus icon for tags

3. Edit a variable.

A “Choose a variable” box will pop up, and the first option, “GA Tracking ID”, is the variable we just created. Select that. 

Edit variables in Tag Manager

4. Click Save.

Now, your tag’s “Web Property ID” should say (or whatever you named your variable). Click save, and your tag is updated. 

Save your Google Tag updates

Google Tag Manager for Wordpress

If your business uses WordPress to host its website, there’s an easy two-step process to integrate Google Tag Manager into WordPress.

There are plug-ins available if you’ve paid for a business version of WordPress, such as DuracellTomi’s Google Tag Manager.

However, if you’d rather do it manually, it’s relatively simple to do. It will only get tedious if you have a ton of different pages of your site and want to use tags on all of them — you’ll have to copy and paste a code below the <body> tag on each page.

Here’s what you do:

1. Copy your tag code.

Copy the Google Tag Manager code you are given during the set-up process. If you’ve already set up your account, click the blue “Google Tag Manager” code beside “Workspace Changes” on your Google Tag Manager homepage (circled below in red). That blue code will also supply you with your specific Google Tag Manager code.

Copy your Google Tag code

2. Install the code in WordPress.

Now, paste that code below the <body> tag of each page on your WordPress site.

Paste the code in WordPress site

Images courtesy of WordPress.org

Now, your WordPress site is prepped for any tags you want to create within Google Tag Manager. Google Tag Manager will automatically code future tags and embed them in whichever page you’ve selected.

Editor’s note: This post was originally published in May 2018 but was updated in December 2019 for comprehensiveness.


seoauditkit-sizedfiles.zip

[3d-flip-book mode=”fullscreen” id=”106275″ ][/3d-flip-book]


[3d-flip-book mode=”fullscreen” id=”106278″ ][/3d-flip-book]


[3d-flip-book mode=”fullscreen” id=”106290″ ][/3d-flip-book]

Scroll to Top