How to Connect Google Tag Manager to a Joomla Site with Shack Analytics

Documentation for Joomla 3

Google Tag Manager's tags allow you to track interactions between your Joomla site and its visitors. For example, you can track clicks on a button, scrolling down a page, submissions of a form, and many more other events on your site.

Before this magic would take place though, you need to connect your Joomla site to Google Tag Manager. In this document, you will learn how to connect your Joomla site to Google Tag Manager with Shack Analytics Joomla extension.

This is a two-step process:

  1. Get the two Google Tag Manager snippets
  2. Set your Shack Analytics Pro.

Let's take a look at this process in more detail.


Step #1. Get the two Google Tag Manager snippets

  • Sign in to your Google Mail and visit this page.
  • Click one of the two "Create Account" buttons:

click create account

You will be taken to the "Add a New Account" page.

  • Fill in the "Account Name" field
  • Select your country
  • Type in your site URL in the "Container name" field
  • Click the "Web" button under the "Target platform" list
  • Click the "Create" button:

add new account

You will see the "Google Tag Manager Terms of Service Agreement" page. 

  • Accept the Terms of Service in the bottom left corner 
  • Click the "Yes" button in the top right corner:

accept the terms of service 

  • You will be taken to your Workspace in the Google Tag Manager console with the "Install Google Tag Manager" modal box open:

copy the code

  • Copy and save the code snippets somewhere safely on your hard drive. You will need these two snippets in the next step to install Google Tag Manager on your Joomla site.

Note: in case you accidentally closed the modal box with the snippets, open it up again by clicking the link resembling GTM-PLXB4J6 on the top bar:

click this link to get the snippets


Step #2. Set your Shack Analytics Pro

  • In your Joomla administrator panel, go to "Components" > "Shack Analytics Pro".

You will be taken to the "Shack Analytics: Tracking Tags" administrative screen.

  • In the top left corner of the screen, click "New":

click new

This will bring you to the "Shack Analytics: New Tracking Tag" screen. 

  • Enter your tracking tag in the "Title" field. 
  • Paste the Google Tag Manager snippet intended to be placed inside the <head> section, into the "Header Script" box, as shown in the next image:

Important: please, make sure you enter the Google Tag Manager snippet in the "Header Script" box without the opening and closing script tags.

header script

  • Paste the Google Tag Manager snippet intended to be placed inside the <body> section, into the "Footer Script" box:

the footer script

  • Click "Save & Close". You will see the newly created tracking tag listed:

the new tag listed

  • In the top right corner, click the "Options" button:

click the options button

This will open the "Shack Analytics: Configuration" screen.

  • Click inside the "Global Tracking Tag" field and then click on your tracking tag:

click on your tracking tag

  • Click "Save & Close". 
  • Open the HTML source code of your site. You should see both snippets displayed within the HTML code. 

You will see one inside the <head> section:

snippet in the head

You will see another snippet inside the <body> section:

snippet in the body section

Documentation for Joomla 4

Google Tag Manager's tags allow you to track interactions between your Joomla 4 site and its visitors. For example, you can track clicks on a button, scroll down a page, submissions of a form, and many other events on your site.

Before this magic would take place though, you need to connect your Joomla site to Google Tag Manager. In this document, you will learn how to connect your Joomla site to Google Tag Manager with the Shack Analytics Joomla 4 extension.

This is a two-step process:

  1. Get the two Google Tag Manager tracking snippets in your Google Tag Manager account
  2. Set your Shack Analytics Pro Joomla 4 extension.

Let's take a look at this process in more detail.


Step #1. Get the two Google Tag Manager snippets

  • Sign in to your Google Mail and visit this page.
  • Click one of the two "Create Account" buttons:

click create account

You will be taken to the "Add a New Account" page.

  • Fill in the "Account Name" field
  • Select your country
  • Type in your site URL in the "Container name" field
  • Click the "Web" button under the "Target platform" list
  • Click the "Create" button:

add new account

You will see the "Google Tag Manager Terms of Service Agreement" page. 

  • Accept the Terms of Service in the bottom left corner 
  • Click the "Yes" button in the top right corner:

accept the terms of service 

  • You will be taken to your Workspace in the Google Tag Manager console with the "Install Google Tag Manager" modal box open:

copy the code

  • Copy and save the code snippets somewhere safely on your hard drive. You will need these two snippets in the next step to install Google Tag Manager on your Joomla site.

Note: in case you accidentally closed the modal box with the snippets, open it up again by clicking the link resembling GTM-PLXB4J6 on the top bar:

click this link to get the snippets


Step #2. Set your Shack Analytics Pro

  • In your Joomla 4 admin dashboard, go to "Components" > "Shack Analytics Pro" > "Tracking Tags".
  • You will be taken to the "Shack Analytics: Tracking Tags" admin screen. In the top left corner of the screen, click "New":

the new button

This will bring you to the "Shack Analytics: New Tracking Tag" screen. 

  • Enter a title in the "Title" field. 
  • Paste the Google Tag Manager snippet intended to be placed inside the <head> section, into the "Header Script" box, as shown in the next image:

Important: Make sure you enter the Google Tag Manager snippet in the "Header Script" box without the opening and closing script tags.

the google tag manager tracking code in the header script box

  • Paste the Google Tag Manager snippet intended to be placed inside the <body> section, into the "Footer Script" box:

the google tag manager tracking code in the footer script box

  • Click "Save & Close". You will see the newly created tracking tag listed:

the google tag manager tracking tag listed

  • In the top right corner, click the "Options" button:

the options button

  • This will open the "Shack Analytics: Configuration" screen. Click inside the "Global Tracking Tag" field and then click on your tracking tag:

the tracking tag selected

  • Click "Save & Close". 
  • Open the HTML source code of your site. You should see both snippets displayed within the HTML code. 

You will see one inside the <head> section:

the google tag manager tracking code in the joomla 4 source code

You will see another snippet at the bottom of the <body> section, as the last code before the closing <html> tag:

the google tag manager tracking code at the bottom of joomla 4 html source code