How to Add Google Tag Manager to WordPress and install in Flatsome Theme

Are you looking to set up Google Tag Manager (GTM) on your website?

In this guide, we will show you how to install correctly and set up Google Tag Manager for your Flatsome Theme Powered Website.

Before we begin, let’s know more about GTM and its benefits. You are probably wondering what Google Tag Manager is if you are unfamiliar with the term. Let’s answer some most common questions about it.

What is Google Tag Manager?

Google Tag Manager is an excellent tool for your digital tracking needs. It allows you to deploy tags on your site without editing your code. This tool will enable you to deploy and update different code snippets called tags.

An excellent example of a tag is the Google Analytics tracking code you add to your website. So that you can track details of your traffic.

You can check this tutorial on how to add Google Analytics with WordPress to the Flatsome theme-powered website.

Not only Google Analytics, but there are also many other tracking services or tag vendors that require you to add a few lines of HTML or JavaScript code to your website to integrate their services. Such as Facebook Pixel, Adobe Analytics, LinkedIn Insight, and advertising tools like Google AdWords.

You can easily add and manage all these codes from a single interface and don’t need to edit the website’s code. There are built-in tag templates for popular services like Google Analytics, AdWords, DoubleClick, etc. However, you can also add custom tags to your website.

What are the benefits of Google Tag Manager?

You can do amazing things in Google Tag Manager once you get over the learning curve. A couple of main benefits include:

  • All third-party code is in one place.
  • It allows you to deploy tags quickly.
  • Migrate all existing tags to GTM.
  • Before you make anything live, you can see what’s working and what’s not.
  • It offers you to deploy multiple tags and manage them from an intuitive interface. 

Setting up Google Tag Manager

To set up Google Tag Manager, you can use two main methods. One is manual, and the other one is with WordPress analytics plugins. The stages are almost the same in each method.

Setup your Google Tag Manager Account

First, visit the Google Tag Manager website and sign up using the same Google account you used for Google Analytics. 

tag manager site

Next, you need to sign in with your Google account. You can notice the Google Tag Manager’s Create Account page once done. Simply click on the ‘Create Account button to get started.


Enter your account name and select your country from the drop-down. You can use your company name as your account name.

create tag manager account

Next, you need to set up your container. It is the collection of tags, triggers, and all the configurations installed on a website.

You can use your website’s domain name for the container name. A container could be a website or an app on iOS or Android platforms. In this case, we will use the web. Click on the Create button to continue once you are done.

container setup

You will need to accept the Terms of Service Agreement of Google Tag Manager to proceed. Check the box to accept the Data Processing Terms, and then click the Yes button on the top right corner.

tag manager agreement

A new popup window appears on the screen upon accepting the terms of service with code snippets to install tag manager on your website.

There are two code snippets to be added. One is inside the <head> tag, and another is in your website’s <body> tag.

install google tag manager

You will need these two codes to set up Google Tag Manager on your Flatsome theme-powered website. So keep the above tab open. It offers instructions on where to paste the code. But if you are an absolute beginner, it can be challenging.

See also  How to Create WooCommerce Variable Products in Astra Theme

Do not worry; we are going to show you the upcoming steps.


Add Google Tag Manager Code Manually


Head to your WordPress admin dashboard in a new tab. Then navigate to Theme Editor under the Appearance section.

Then click on the Theme Header from the right side to launch header.php within the theme editor.

As per GTM account instructions, copy the first code and paste it into the <head> element as shown in this image.


Then copy the second code and paste it immediately after the <body> tag as shown on the image.


Hit the Update File button at the bottom of the screen to save your settings once done.

There is another method to add GTM code to your Flatsome Powered website.

Add Google Tag Manager on the Flatsome Theme option

Head to your WP admin dashboard.  Check for Advanced under Flatsome and click on Global Settings.


You’ll find both Header Scripts and Body Scripts to paste your analytics code.


Save All Changes by clicking on the button below on that page.

Note: we suggest you use a WordPress child theme if you go the manual route. Otherwise, your tracking code will be overwritten if you switch or update the theme.

See also  23+ Best Free WooCommerce Themes in 2023

Add Google Tag Manager using a Plugin

If other methods seem difficult for you, then add using a third-party plugin.

Let’s see how you can take the help of a plugin to insert the Meta tag exactly where it is needed.

Navigate to Add New under Plugins on your WP admin dashboard.

There are different plugins that you can use to add the GTM code. But here, I recommend Insert Headers and Footers plugin.

You can follow this guide to get help on how to install a WordPress plugin.

Once you install and activate the plugin, visit Insert Headers and Footers from Settings.

Then copy and paste the GTM code in the header section and click on the Save button to store the settings.


Add and Publish Tags in your Tag Manager

Once you have installed GTM on your website, you are ready to add code snippets (tag) provided by different tracking tools.

Now go back to the GTM dashboard, click the ‘New Tag’ button, and follow the steps to create your first tag. You can add different tags in your GTM container by following the same method and integrating your Flatsome-powered site with various tracking tools.


Google Tag Manager supports over 50 tag types. Tags in Google Tag Manager will not go live until you publish the container. So you will have to submit it from the GTM dashboard once you create your new tag.


Google Tag Manager is a powerful tool that helps put a lot of power in your hands to manage tags and collect actionable data. When you can set up the tool easily and quickly, you have more time to plan how to use all the data you can collect. It will help you with different kinds of SEO tips and tricks,

We hope this guide helped you to learn how to install and set up Google Tag Manager on your Flatsome Theme-powered website.

Subscribe To Our Newsletter!
Hi, I’m Mohamed. I share delicious recipes that I have cooked and loved. I’ve been food blogging for over 10 years and have a Diploma in Nutrition. You will find many healthy recipes as well as my favourite comfort food on the blog because I believe in a balanced diet.

Related Posts

Fintech’s biggest hits and misses of 2023

As 2023 comes to a close, we’re here to look back at the biggest fintech stories of the year. Silicon Valley Bank’s implosion felt like a fintech…

It’s critical to regulate AI within the multi-trillion-dollar API economy

Alex Akimov Contributor With two decades of tech leadership experience, Alex Akimov, former head of API at Adyen, now revolutionizes embedded finance at Monite by building best-in-class…

EU’s provisional deal on gig worker rights fails to get enough backing from Member States

Not so fast on that Christmas present for precarious gig workers in the EU: A political deal announced mid month, which aims to bolster platform workers rights…

Arduino exploring India manufacturing to limit counterfeit sales

Arduino is considering manufacturing in India. The startup, best known for its open source microcontroller boards, hopes to restrict the rise of counterfeit boards and cater to…

Top robotics names discuss humanoids, generative AI and more

Last month, I took an extended break. In a bid to keep my robotics newsletter Actuator (subscribe here) up and running, however, I reached out to some…

Pornhub owner pays US government $1.8M to resolve sex trafficking probe

Pornhub’s parent company Aylo Holdings will pay $1.8 million to the U.S. government to resolve a charge of profiting off of sex trafficking. The company, formerly known…