Add GA code to a website using GTM
Select workspace, I use default, or you can create a unique workspace and name it for this exercise.
Select - Add New Tag, give it a name, you can select folder and place it in a folder (icon next to title)
Here we define the tag and then define how to trigger it (on all pages or when certain conditions are met)
Click pen (Tag Configuration) to view supported tags which will be listed upon click, and includes custom HTML and Image options. Easy interfaces are present for the other supported tags.
Select Universal Analytics from the list presented, this is the GA Tag we require. You will be presented with fields –
Track Type – Select Page View (basic level), you can also select other Track Type options, page view is the default setting for GA tag.
Google Analytics Settings (tracking)
Create New , if used in the past it will be listed so a new one won’t need creating just select it.
Give a Name to the new Variable, and enter GA tracking id, the id is taken from GA account in Admin section.
Cookie Domain – auto unless doing cross domain tracking
Hit Save
You can Check Enable override settings in this tag if you do not want all properties to come along with this tracking, leave unchecked if you do. Usually leave it unchecked for this option.
Hit Save then you’ll have the option to Add Trigger
Select Add Trigger, as this will be needed for the tag to fire.
Choose a trigger, all Pages is set as default so tag will apply to all pages. Hit + button if you want to create a custom trigger.
Select All Pages, then Click Add, this then adds the trigger to the tag.
Hit Save
The Workspace now updates in Editing and Workspace lists the actions performed.
Preview
Once complete, it can be tested in Preview, click Preview to see site in preview mode and tag can be viewed. In preview panel a summary of tags fired are listed. Summary and other options are present on the left, DOM Ready and Window Loaded shows tag has to be fired after DOM is ready, once all elements are available, it waits for DOM to be ready so we can access certain elements like forms etc.
Window loaded means page is fully loaded, values here may need loading before the tag is ready to fire.
Variables in the top menu
Referrer value – will display where the visitor came from – HTTP Referrer
Page Path if slash it’s home or index page
Page URL shows current page
Once debugged go to GTM and hit Submit to publish, give the version update a name – just call it what you’ve done.
The Version will update once complete, and your work is published.
It’ll now be in the Variables menu, and edits etc can be made from this entrance viewpoint or window.
You can click on Folders to view folders you created to house tags that you have created. All Folders are listed in the Folders Window.
Contact MattLet me check out your website
Absolutely no obligation with this, I'll not bombard you afterwards with work needs. You'll get a free report on your websites current state, if you want to action any findings or question any aspects then I'm sure you will be back in touch.