Checklist for Google Analytics and GTM Friendly Website Development

Checklist you can go through yourself or share with your developers to avoid common mistakes.

It is a follow up to the article 7 things to consider for Google Analytics friendly website development, but in a shorter form (please raise hands who likes to read long articles, if they are not from Avinash Kaushik, of course) and with new points added.

To have your website Google Tag Manager and Google Analytics implementation-friendly I recommend to follow the list below:

  • Add Google Analytics or Google Tag Manager tracking codes in the <head> section. Having it in the footer you risk losing data. Lunametrics have a good article about different placement options.
  • Use human-friendly URLs. Example:
  • Be consistent with namings conventions for classes, ids, URLs, hashtags and etc.
  • Use class/id attributes on key website elements, such as forms and call-to-action buttons. It will make Google Tag Manager configuration much easier.
  • If using lots of JavaScript/AJAX functionality – you probably will be missing some valuable data in Google Analytics.  Consult with a Web Analytics specialist and add custom event and virtual pageview hits to gain better view on user behaviour.
  • For key user actions, such as registration, form submit or purchase:
    • Have a clear action confirmation page (“Thank You page” ) or message.
    • Where possible, avoid redirects immediately after the action and “thank you” message.
    • If the “Thank you” page does not have a separate URL  and confirmation is done using JavaScript & AJAX – consult with a Web Analytics specialist and add custom event or virtual pageview hits.
    • If it’s a purchase – enable Ecommerce or better Enhanced Ecommerce reports and send additional product related data to Google Analytics.
  • Avoid e.stopPropagation() or return false for link click action overwrite. Use e.preventDefault() instead.
  • Use push() method for Data Layer interactions. If you need to assign variables as early as possible, you can declare dataLayer=[{}] only before the GTM tracking code. It drops all previously declared variables, while dataLayer.push({}) appends them.
  • Save query parameters (like ?utm_ or ?gclid ) when doing redirects. By truncating those, valuable advertising campaign data is lost.
  • Don’t use utm_ tagging for internal links. It will rewrite original traffic source and screw analysis and conversion attribution.
  • Don’t use iframes. Just don’t.
  • Don’t remove or change Google Tag Manager or Google Analytics codes before making sure it won’t impact data collection and reporting. Because you shouldn’t change things you are not sure about and that might be heavily used by marketing department or partner marketing agency.
  • Inform the specialists responsible for Google Analytics implementation in advance (!) on any planned website functionality and design changes that may require tracking adjustments. Of course, it can be done after the changes, but then some data will be lost.. together with time and nerves :)

Will keep this list updated, although, I secretly hope it will actually become smaller along with increasing web analytics expertise of the parties involved.