Here are the tools you’re going to need to perform the task. It’s essentially the same set of tools for any HTML / CSS / jS front end work coupled with some Google properties. If your website requires an FTP uploader, GitHub, or the like, you’ll need that as well.
- Your Google account
- Place to store the passwords for yourself
- Place to store the passwords for the client
- Logins to the website
- Client info for backup & recovery: email, phone. I’d use this new Google Account for it, and forward the Gmail to your webmaster account :-). PS: Use your webmaster email as the backup email, but you probably knew that already.
- Text documents / code editor to store copies of the Google Analytics UA number and a copy of the Google Tag Manager container code. Keeps the code cleaned of markup shit.
- Google Tag Assistant extension in Google Chrome
- Set up a Google Account for the web property
- Log into Google Analytics with web property’s Google Account
- Set up a Google Analytics profile for the web property
- Set up a Duplicate Google Analytics view for the profile. Best practice: always leave a raw, unfiltered copy of the profile running in case someone messes something up. Data only flows in one direction.. You don’t want to lose it.
- Copy the Google Analytics profile’s UA number in a separate text doc / code editor.
- Make a copy of the standard view for Google Analytics. It will serve as the raw data backup for the profile.
- Log into Google Tag Manager with the new web property’s Google Account
- Set up a Container for the Web Property. Place a copy of the container code in a separate text document
- Make a Google Analytics tag
- Make backups of the Web Property where the work is to be performed (header.php file (WordPress), or accompanying template / layout.
“What about a Google Tag Manager WordPress plugin?”
Well, if you can find one that an author keeps updated, go for it. Otherwise, get ready to get a little code-messy. (Trust me. I’m hoping the moment I publish this I find out Yoast updated their Google Analytics plugin to accommodate this. Until then).
- Copy the Google Tag Manager Container code and place it on the website just after the opening body tag.
- Upload the files and perform a view source of the site in a web browser to confirm the container code is directly below the opening body tag and is not breaking shit.
- Check Google Tag Assistant in Google Chrome to make sure the container and tag are operating properly. If there is an issue, the Tag Assistant will tell you what it is.
- Cross browser test: Check the site in IE, Chrome, FireFox, and Safari at desktop, tablet, and mobile widths (Google Chrome Dev Tools is great for this) to make sure nothing is broken.
- Take a bow.
When I have to set up Google Analytics codes, I typically set it up as a third party on behalf of another: an agency for a client / customer, agency on behalf of another agency for a client / customer. When I write this task, I do so as someone who has to look into the future, the deep future, and consider the full life cycle of the tools.
Using best practices set up a Google Analytics code.
I write this assuming that Google Tag Manager has not yet been installed on the site. If it is, then you can skip a few of the “backup” steps and go straight to set-up Google Analytics UA number in Google Tag Manager.
As previously stated, I hope that Yoast decides to go ahead an make a plugin for this, because they’ll at least keep the plugin updated. No one else is right now.
“Why do we need another Google account? “
It’s typically considered a best practice to set a Google account for every web property, even though Google Analytics account can set up to 100 profiles. Initially, 100 properties sounds like a lot, but once a company starts conducting tests and experiments, those 100 properties start to get used up quickly.
The other reason is that while the client plans on having their property indefinitely, the truth is that properties get bought and sold, either as an asset or as part of mergers. You’re going to want to be able to pass off the data seamlessly. There are less headaches this way.
Don’t worry. While a Google account can set up to 100 profiles, it can be given profile permissions to an infinite amount of profiles from other Google accounts. This means you can set up a Google account specifically for the profile and then add your profile as an admin, and put in as many profiles over 100 as you’ll need.
Back in the day, the best practice was to place Google Analytics directly onto the code. It used to be below the closing body tag. Then it was directly above the opening body tag.
Now, they want you to use Google Tag Manager, placing the Google Tag Manager code directly after the
Possibly speaking from experience, you don’t want to be the the developers track down and decide you’re the one who shut down a couple hundred sites because you accidentally dragged a folder into another folder. Make backups so if you jack this up, you’ll be able to at least quickly get everything back to where it was before you started it.
If it’s website specific, message me.