Marketers: Install Google Tag Manager on Your WordPress Site in 4 Minutes

/

install-gtm-on-wp-in-4-minutes
50% of the top million websites use Google Tag Manager, the incredibly powerful analytics/marketing tool that quickly deploys tagging across your website. Want to do Facebook remarketing? Subscribing to HubSpot, Pardot or another marketing automation service? Need to add an AdWords conversion tag?

So many actions marketers take require additional tracking code to be placed on website code and Google Tag Manager will handle that for us. Best of all, you don’t have to be an analytics nerd to implement this! Tag Manager empowers marketers to own and make changes without development or technical help. I’m not a coder at all, and I’ve launched GTM on a few dozen WordPress websites.

In the simplest configuration, Google Tag Manager fires and controls the Google Analytics tag on your website. See our post “What is Google Tag Manager? (And How Does It Work With Google Analytics?)” below for more gushing.

Here’s What You’ll Need:

  • Knowledge Of Self: Critical for all marketing projects but for today, ask yourself: Does my website have tons of traffic and lots of QA checks and dev process to do anything? If so, go talk to IT about this just to make sure it’s cool. If you are working on small-to-medium sized business or non-profit, proceed!
  • WordPress Admin Access. This needs to be a WordPress site you control, not the freebie ones on wordpress.org.
  • Google Account. Ideally the one you use for Google Analytics.
  • Google Chrome Browser. You can download Chrome here.
  • Egg Timer. Mine looks like a Penguin because LunaMetrics is in Pittsburgh.


shopping

1. Set Egg Timer for 4 minutes

Easy, right?

2. Sign Up for Google Tag Manager

Navigate to the Tag Manager page and to sign up for free. 

google tag manager sign up page

Create a new GTM account. Account name best practice: Use your company name (e.g. Alice’s Wonderland Resorts LLC).

google tag manager account name screenshot

Now name your container and choose what you want to track. Since we’re talking about WordPress websites here, select Web. Container name best practice: Use the domain name of your website (e.g. www.aliceswonderlandresorts.com).

create google tag manager container

3. Get Dat Code

Yes, I told you this wouldn’t be technical. It’s not! We just need to do a few copy / pastes. Once you click create, you’ll be presented with the following popup that contains the code that needs to be added to your site. This code snippet will have your Container ID, which is super important! Mine below is just an example. Don’t use it.

4. WordPress Editor

In WordPress, navigate to Appearance, then Editor. If you don’t see this option, then you do not have Admin access to your site.

wordpress-appearance-editor

Look on the right-hand side and you’ll see the files the make your WordPress template work. Look for Header.php and edit. This files controls all page templates in WordPress.

Paste the top portion of GTM code right after the opening <head> element (see screenshot). Use your browser search to locate the <head> if needed.

gtm-new-1

Paste the second portion of GTM code right after the opening <body> element.

gtm-new-2

Don’t monkey around with other stuff! Seriously.

When you’re done, click Update File.

5. Import a Recipe (If you Want to do GA Stuff) Or Add a Tag for a Non-Google Service

Head over to lunametrics.com and grab our basic recipe pack for GTM to do some Google Analytics tracking. This GTM pack will allow you to easily add ready-to-go tags to your new GTM container. If you have Google Analytics installed already, the recipe instructions will tell you how to add your tracking number to GTM.

recipe-1

Note: you don’t have to set up Google Analytics through Tag Manager, but it’s recommended. You can install Tag Manager and leave your existing Analytics in place. Learn about how Google Tag Manager and Google Analytics can work together.

Super Important Note: Google Analytics should only load on your page once. If you’re using a different WordPress plugin to load Google Analytics, then do not also load Google Analytics through Google Tag Manager.

Maybe you just need to install a Facebook remarketing snippet without a developer, use Tag Manager! But if you would like to migrate your Google Analytics tracking to Tag Manager, see our blog post that covers some other points about migrating your on-page Google Analytics to Google Tag Manager.

If you need to set up tracking for external service because you want to do some advanced marketing tracking or measure conversions from social or paid ad spends, it’s easy! Google Tag Manager comes pre-loaded with tons of external tags (view list) or you can use a special tag called a Custom HTML Tag to paste in other tags.

Here are GTM instructions for integrating popular marketing tags:

Remember to test your tags before publishing them. Google Tag Manager has built-in previewing and debugging. We also cover a few Chrome extensions for debugging that will come in handy!

6. Verify Your Install

Tag Assistant is a nifty freebie will look for the GTM container in your site source code and let you know that everything works. Add Google Tag Assistant to Chrome from the Chrome Store.

tagassist

Now, re-load your website and open Tag Assistant. You should see a happy little face with your container ID:

tag-happy

Ding! My timer just rang. Did you make it? Remember, you don’t have to migrate Google Analytics right away if you just need to get one advertising tag on your site via GTM. You can do that step next (Spoiler: it takes longer than 4 minutes) and we’d love to help. Have you done a quick & dirty GTM launch like this in the past?

Michael Bartholow is a Senior Search Project Manager. He has a special knack for B2B Lead Generation and e-Commerce Marketing. Michael holds an Integrative Arts degree from Penn State University and uses the same SEO & PPC skills he once employed to promote award-winning independent films to help businesses across a variety of verticals find audiences. He has Google certifications in Analytics & AdWords.

  • Marcos

    Great post. Quick question, if you modify your header.php don’t all your tags will be lost if you update your theme? In other words, if you update your theme, you will have to install GTM again. Ok it’s only 4 minutes but still.

    • Marcos – You can avoid that problem of switching themes, by using a plugin that accepts the snippet. For example, we have a free plugin on the WP repository called Header Footer Code Manager. You can simply paste your snippet in there, and that would resolve any potential issue of losing your snippet if you switch themes.

  • DuracellTomi

    (shameless self promotion)

    …or you can use my GTM WP plugin if you do not want to edit your theme files and also get some fancy dataLayer content without coding 😉

  • I am very new to Google Tag Manager, this is the easiest tutorial I have found ever, so far without the confusion. I got one major confusion cleared now, Wheather to add GA code first and then add GTM tags. Thanks for sharing this time saver information with us.

Contact Us.

LunaMetrics

24 S. 18th Street, Suite 100,
Pittsburgh, PA 15203

Follow Us

1.877.220.LUNA

1.412.381.5500

getinfo@lunametrics.com

Questions?
We'll get back to you
in ONE business day.