GTM – Understanding the Data Layer

What is the Data Layer?
– Basically a layer on top of your application where you can pull information from the application itself to use in tag manager as either variables or triggers.

—> let’s say you want to track user id, price of item, etc. and forward it to GA. you would use a datalayer with GTM to extract that data that you set in the data layer

  • so you code the data layer into your site using javascript or w.e, then you can use GTM to extract / use that data within variables/triggers for custom tracking

GTM Events – This is different than events in GA. This is just basically checkpoints of when shit gets loaded.

Module 2.3 – How to Push Data into the Data Layer

Doing data layers always use event keys and name it something, otherwise it’ll just come up as “message” on Tag Assistant

Don’t need to code dataleyer for every page, code this into the theme page or some shit and then use scripts/php to pull in variables so it runs on every page

Event = Custom Checkpoint
Objects = “key: value” pairs – this is the information you’d want to pull from the page

Module 2.4 – How to Write a Datalayer

can use the datalayer builder tool from mreasureschool

You can use plugins for the datalyer, or you can code that shit in hard.
WordPress – Google Tag Manager for WordPress
Plugins can break given stuff that’s supposed to be there is custom

Module 2.5 – Variables

Placeholder for data you can pull shit from

As events fire and time goes on (remember events name the actual “event” in GTM), variables can change so make usre you pull the variable from the right event.

read haro emails for keywords

Don’t fire my tags while i’m debugging my site / don’t record

Module 2.6 – Triggers

Every Trigger has an event (event where it fires) then it has a filter to be more granular on what actually fires

Pageview are default events that happen anyways – always happens when a page is loaded

Triggers go as “event” label thing within the debug

Blocking triggers have to be on same event, otherwise it wouldn’t even fire to begin with (would be useless)

Module 2.7 – Build Triggers to Rule Your Tag Deployment

Triggers can be added to tags to be either an “or” or “and”.

For “or”, the trigger can be fired two times. for “and”, both requirements need to be met before the tag is fired

Module 2.7 – Tags

If tag is not found within the given tag templates, you can just use custom scripts.

Module 2.8 – Q and A

Domready, window loaded, page loaded, all this happens within 2 seconds, but theyr’e different checkpoitns for data. you have tags that fire at certain points, you want to make sure that the data is actually available, but at the same token youd on’t want to wait till the last moment or until everything is loaded to fire the tag, cause data changes too (or fast link clicks)

Tag Sequencing – You don’t need to set up a trigger for the sequenced tag, it just fires before or after the tag you couple it with.

Module 3.0

  • Begin with the end in mind
  • -> why do you want to track that?
  • -> what will you do with that data when it comes in? slash if its true or false?
  • -> is there an easier way to track this?

There are MANY ways of tagging shit and getting the same data. There are best practice to follow though

  • keep tags minimal to keep loading speed down
  • keep documentation undersetandable
  • keep everything in order and reliable, follow one way
  • document everything!

3.1 – Page Tracking Tag