How to Add Google Tag Manager Code to Astra?

How to Add Google Tag Manager Code to Astra?

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 doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

On this page

Take the First Step Toward Success Now.

You’re backed by an amazing team and a risk-free money-back guarantee!

Download is Just A Click Away!

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

This field is required.

REWIND

YEAR IN REVIEW

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