No results found. Try again with different words?

Search must be at least 3 characters.

How to Add Google Tag Manager Code to Astra?

Sidebar Image

Did not find a solution? We are here to help you succeed.

Site Builder module available with Astra Pro Addon plugin allows adding Google Tag Manager code to the website. It provides hooks so that you can insert custom code at various locations on the website without editing theme’s core files.

This is a premium feature available with Astra Pro Addon plugin. To use these Pro features, you need to have the Astra theme along with the Astra Pro Addon installed on your website.

Go through the following sections of this document to know more about how to add Google Tag Manager code using Site Builder module in Astra Pro.

How to Add Google Tag Manager Code to Astra?

Google Tag Manager code has two code snippets. One to be added as close to the opening <head> tag as possible and other immediately after the opening <body> tag. To add both code snippets, add two different Custom Layouts. Below are the steps to create Custom Layout and add code using hooks.

1. Custom Layout to add code to <head> tag

  • Activate the Site Builder module from Astra Pro.
  • Add a new Custom Layout from Astra > Site Builder
  • Select Hooks layout
  •  Insert the code in the Code Editor and set wp_head as action.
  • Choose to display it on Entire Website.
  • Publish the layout.

2. Custom Layout to add code to <body> tag –

  • Add a new Hooks Custom Layout.
  •  Insert the code in the Code Editor.
  • Select Hooks layout and add body_top action.
  • Choose to display it on Entire Website.
  • Publish the layout.

Thus by successfully integrating Google Tag Manager into your Astra website, you’ve opened a gateway to enhanced tracking, analysis, and optimization.

We hope this document has been helpful. If you have any queries further, feel free to leave a comment below.

Was this article helpful?
Sidebar Image

Did not find a solution? We are here to help you succeed.

Related Docs

Join 1,653,898+ Happy Site Owners Using Astra

Whether you are a beginner, small business owner, or professional web developer, Astra provides all the tools you need to easily build your beautiful WordPress website.

Download is Just A Click Away!

Membership Retention Checklist Download

REWIND

YEAR IN REVIEW

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form
Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form