Categories: Portals

In June 2020, I put together a 30-day series that covered Google Analytics. Since then, I have had several questions about how you can add it to a Dynamics Portal, but using Google Tag Manager. So a quick blog and video hopefully will help! Here are the main points, but the video walks through the entire thing, with creating your Google Analytics (GA) account, and then adding the Google Tag Manager (GTM) code to the portal. If you are not sure of the purpose of GTM or how to get started, check out this post for more information and how to add your GA tracking code to GTM. Once you have done this, continue with the next steps.

Now the GTM code needs to be added to your Dynamics Portal. This can be found from the Admin area then going to Install Google Tag Manager.

We can see here that the code provided is in two parts. The first should be added as high in the <head> tag as possible, while the second should be immediately after the opening <body> tag.

Speak with the person who set up and configured your portal to see which option is right for your implementation, but the code should be added to the header web template. This can be done using a Content Snippet and adding that to the template, but below I have added it directly to the source code of the file. At the very top of the file, paste the first set of code you have been given in GTM.

We don’t have direct access to find and get to the <body> tag, but pasting the second lot of code from GTM at the bottom of the header web template will work. Save the file once you have added both sets of code.

Once you have saved the file, go back to GTM and submit the changes. Then, click on the Preview option. This will put your site in to preview mode (only for you), which then allows you to go and visit the portal in a browser. If you already had the portal open in a tab, make sure you refresh it.

You should now see the Tag Manager panel at the bottom of the site. What you are looking for is to make sure the Google Analytics tag actually fired. This shows that you set up your GA variable and related tag correctly, and you have the GTM tracking code in the right place on your portal.

If you then open up Google Analytics, you should see that you have one visitor (that is you!) right now. That’s it! You can now use Google Analytics to review and analyse the traffic to your Dynamics Portal.

Check out the latest post:
Predefined Placeholder Access In Customer Insights - Journeys

This is just 1 of 456 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.

2 thoughts on “Using Google Analytics & Google Tag Manager In A Dynamics Portal

  1. Hi Megan,

    Do you know how to remove Google Analytics from Dynamics Portal and only use the Tag Manager. When I added Tag Manager snippets to the Header, it showed a conflict as we had both Analytics and Google Tag Manager.
    I can’t remove the code snippet from Enable Traffic Analysis as it’s a required field.

    1. Hi Richard, are you referring to a Content Snippet? If so, the value shouldn’t be required by default. You might need to adjust that entity and make it not Business Required if someone has adjusted that in the past.

Comments are closed for this post.