In this tutorial we’ll be going over switching out your Google Analytics code on your Divi site with Google Tag Manager (GTM). Through GTM you can now replace hard-coded tags directly on your site to help reduces errors in case you have to edit code on a production environment or if you have to hire a developer or webdesigner to make or test these small changes.
On Google Tag Manager
To get a Google Tag Manager you first need to go to the site here. Note If you already have a Google Account make sure you’re signed in or if you don’t have an account with Google create one first.
Once you’re signed you’ll need to add a new account, you can follow the instructions on the screen to set up your specific account name, container name and then retrience you code. Side Note: The container just represents the code snippet used in web development that removes the need for multiple data tracking codes being placed directly on the site.
Quick Jump to Divi
Add you recently acquired GTM code to your divi site by going to:
Divi // Theme Options // Integrations
Quick Jump back to GTM
Let’s now get GTM set up now with Google Analytics. Back on your GTM dashboard select new. Once on the new window you’ll want to name your tag something obvious, like oh…let see… how about Google Analytics!
Select the Universal Analytics Tag Type
Under Google Analytics Settings, click the drop down menu and select New Variable. My image might look slightly different but that’s only because I’ve already done the following setp
Under tracking ID insert you Google Analytics ID. You may need to make a quick jump over to Google Analytics to to copy and paste the code inside.
Expand Advanced settings. Under Tag Firing options select Once Per Page.
Set a Trigger
Your final step will be to click the trigger box and select All Pages. Once this is done you’ll be able to save and you’re Google Analytics code will now work through GTM. You can also test to see if the Analytics code is firing once per page in the Preview section of the dashboard.