Web analytics set-up for everybody

Setting up Google Analytics and other tools

Hay 👋🏾

Setting up analytics and optimisation tools seem daunting. Especially if you don’t have years of expertise in data or product manager roles at start-ups. However, I’m here to tell you that the set-up isn’t all that hard.

It all starts with..

Google Tag Manager

A lot of my former workplaces used some kind of containerised tag management system. It allows trying out new data collection tools and even onboarding or UX tools quickly.

This is what Google Tag Manager (GTM) does for you. You can put a snippet in the head and body sections of your website for a container system. Then use Google’s easy UI to add whatever code other tools require. This saves the hassle of going back to developers to push a line of code each time you want to try a new tool which lets them concentrate on what they do best. GTM also has built-in version control and easy ways to collaborate with others in the analytics team.

I actually use it on my personal WordPress, somewhat out of habit, here is how you can too. 🤓

  • Make a Google Tag Manager account and sell your soul to Google (kidding, it’s already too late)
google tag manager snippet
  • They will provide you with two code snippets to put into two separate places on your website, don’t worry if you are not ridiculously tech literate.
  • Install a reputable plugin to inject code into your header or footer. Alternatively you can go into theme editor if you aren’t nauseous when you see things using PHP. If you work somewhere and this isn’t for your personal website then ask your lead dev because otherwise they get angry.
Wordpress plugin for headers
  • After installing and activating the most popular plugin either by installs or reviews or whatever your criteria for reputation add the GTM snippets. I used the first plugin from the results.
Wordpress settings to put analytics snippets

Now the tools ⚙

I tend to use these

  • Something to collect visits and click data like Google Analytics
  • Something to record journey data like Hotjar

Other things I would consider adding are

  • An onboarding tool for a site with many features
  • Some kind of live chat tool for support
  • A few optimisation tools or an A/B testing product. I have a bunch of experience with Adobe Target but Google has its own A/B testing tool. I have nice keep-cup I got from optimizely so maybe they are good too 🤷🏾‍♂️.

Here is how you setup Google Analytics

  • Start by making a new tag and name it something stupid
Setting up a new tag in Google Tag Manager

There are two main things to keep in mind, configurations and triggering.

  • Click configurations and luckily enough it automatically has an option for Google Analytics. Use GA4 configuration, it’s newer and has better features.
  • Triggering is what triggers the tag, like a page view or click etc.
Setting up google analytics
  • Put in your tracking code. If you didn’t already have one then now is a good time to create a Google Analytics account. Hopefully in a new tab.
Introduction to google analytics
  • When signing up for Google Analytics select web, their UI changes often so be a little resourceful.
  • They should give you something called Measurement ID which you need to put into Google Tag Manager if you had the foresight to leave that tab open.
Setting up the data stream for your website
A completed google analytics set up in tag manager
  • After saving your set-up we now have to publish the tag. Otherwise the changes don’t go live. Click submit on their home page and give the tag you are publishing a nice version name and description.
Pushing your tag to go live in google tag manager
  • You can check if Google Tag Manager is working on your website by using Google’s Chrome plugin for GTM or any other similar plugin. My GTM plugin requires clicking record and refreshing the webpage to see the tags.
Testing whether your container is live

Here is how you set Hotjar up

  • Create a free personal account (or pay for one of the better ones)
  • Go through their onboarding, they will ask you to put in a valid URL (this is your website, not any random valid URL)
  • If you set up GTM properly they will give you a code snippet
  • I gave them permission to set it up for me since I’m lazy but you can follow the same steps as before. You can revoke the permissions later if you want.
Setting up hotjar
Using google tag manager to get your hotjar snippet running
  • Now click edit session targeting. Setting it up was not enough we need it to collect some data 🥰.
  • Change the setting to ‘Capture sessions shorter than 30 seconds.’
Capturing sessions in hotjar on your website
Amending the tracking settings in hotjar

AWESOME 🎊

You have now learned how to properly set up a couple of things but you can extend it to any number of modern tools that are used by progressive organisations.

To review

  • You can install Google Tag Manager
  • You can add new Tags
  • Configure useful tools like GA and Hotjar

Things you can learn

  • Creating custom triggers in GTM
  • I used data-attributes extensively, to the dismay of my devs
  • Learn how to properly use GA and Hotjar or any tool you use
  • Analysing the data, apparently analytics creates questions and analysis helps find answers but idk.
  • I kind of use Cloudflare as a CDN alot to see some stats but it isn’t necessary
  • Might as well use Google Search Console, you can verify you own the domain with your existing GTM or Analytics set up.

If you are looking to analyse data then you can get your python environment up and running with my other article.

https://freshprinceofstandarderror.com/ai/setting-up-your-data-science-environment/