How to Set Up Google Tag Manager (GTM) on Your Website Quickly
Tags: googletagmanager, analytics, marketing, javascript
Published: 2022-12-25 23:55:02

**First** - _What on earth is Google Tag Manager? Google Tag Manager (GTM) is a [tag management system](https://en.wikipedia.org/wiki/Tag_management_system). A 'tag', in this context, is essentially a relatively small fragment of code. Google Tag Manager allows us to easily add, update, and determine how these fragments of code are used in the measurement of user behavior on a website or app. Measuring user behavior is central to digital marketing for A/B testing, campaign data analysis, conversion tracking, and more. Many tags are built into GTM, allowing non-technical people to make many tracking implementations without the help of a developer. For more complex implementations, custom HTML and JavaScript can be used in GTM._


**Here's how to install GTM on your website.**

**1. Create a GTM account**
Before you set up Google Tag Manager (GTM) on your website, you need to make sure you have an account, so go to [tagmanager.google.com](https://analyticsinstitute.hashnode.dev/how-to-set-up-google-tag-manager-gtm-on-your-website-quickly#:~:text=tagmanager.google.com) create one there.

**2. Set up a web container**
When you’re done, you’ll also need to create a new GTM “container” where all the tags for your site are kept or contained, as the name suggests. In the case of setting GTM up for your website, you’ll want to select “Web” as your target platform. In the menu, you will see other target platform options such as iOS, Android, AMP, and Server, which we will cover in other blog posts.

**3. Find the GTM installation snippets and copy**
Once you have the container set up, make sure you are on the “Workspace” tab on the upper-left hand side of your GTM interface. When you’re there, you will be able to see a container ID on the right-hand side of the interface in the form of a link, pre-fixed with “GTM-“.

![GTM workspace](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5v9jw3dyoc8k7zokmra3.png)

Click that link, and a modal titled “Install Google Tag Manager” will pop up with further instructions on your next steps.

![GTM installation code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u1lgvjtkmtncqf7k1jgm.png)

Start with the first snippet: highlight and copy it into your clipboard, or simply click the copy icon on the top right.

**4. Paste the snippets into your website’s base code**
Depending on how you have your website set up, the process of pasting the GTM installation snippets may vary somewhat. If you are working only with hard code, and not using a popular content management system like WordPress, for example, you’ll have to find the relevant files in your website code and insert the snippets in the right locations. As indicated in the GTM documentation, simply paste the code snippets in their respective places in the `head` and `body` of your code.

_Okay, that makes sense – you might be thinking – but my website is powered by Wordpress. Now what?_

**Install Google Tag Manager on your WordPress Website**
Finding the head and body of your website may not be so straightforward to everyone working with WordPress. Luckily, there is a WordPress plugin that you can install called 'Insert Headers and Footers by WPBeginner'. So, go to your WordPress sidebar, click Plugins and search for this plugin. Next, install it!

![Wordpress plugin - Insert Headers and Footers by WPBeginner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qjaw4s1go2p2gccoviat.png)

Now that it’s installed, go to **Settings**, then click **Insert Headers and Footers**. Voila! This is where you will have to paste your GTM installation snippets. After pasting them, remember to save them.

![Insert GTM into wordpress site](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8lnvgvehhlaalq8dlr7q.png)

If you are using a platform other than WordPress, the process is the same. Find a way on that platform to be able to insert the GTM installation snippets into the `header` and `body`.

**Checking Your Setup** 
Now, how can you quickly verify that you now have GTM set up on your website? One way is to check that your first tag fires. But even before doing this, you could download a Chrome extension called Google Tag Assistant (Legacy). Go to your website, enable Google Tag Assistant, then refresh your page. If GTM is properly set up, you’ll see it next to the green tag icon like below – congrats!

![Google tag assistant legacy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jr3lh5acus899405he2m.png)


_This post was originally published by [Analytics Institute on Hashnode](https://analyticsinstitute.hashnode.dev/how-to-set-up-google-tag-manager-gtm-on-your-website-quickly) on Nov 25 2022_.