Google Tag Manager for Beginners
What is Google Tag?
Google Tag Manager (GTM) is a data collection & routing engine that can be used to collect the user (event, actions, attributes) data from your web application & send it to various reporting tools like Google Analytics, CrazyEgg, FaceBook Event Manager etc. Segment (https://segment.com/) is a comparable tool to GTM.
All you need is a GTM script added in your web application!
Yes you read that right, only GTM script JS file need to be included in your source code & rest of the analytics JS files like Google Analytics, FB Pixel, FullStory etc., whatever you may need for measuring the metrics on your web application can be installed through GTM Workspace.
Creating a new Tag
Once you have an account created on GTM, you might want to create your first tag that is basically telling GTM to insert a snippet of JS code (Tag type ‘Custom HTML’) into your web application or defining an event with appropriate category, action, label & values that can be sent to several of the 3rd party event capturing platforms like Google Analytics, CrazyEgg etc.,
Creating a new Trigger
Creating a tag is only half of the work done, you will need a trigger for the tag to be invoked & sending of the data to 3rd party services. You can create this as part of tag creation or use the triggers menu to create a new one. Trigger is nothing but an event happening on the web application by the user — like he / she viewing a page, clicking on a button, link etc., that can be specified by DOM element type, class etc.,
How do I test the newly created tag / trigger, before going live?
You should be using the Preview feature of GTM, once you click Preview the latest code will be available to debug on the same browser by opening — stage / production / localhost URLs, along with a little GTM debugger pane on the browser.
Publishing the changes to production
Once you are done with verification of the changes via Preview mode, go ahead & click ‘Publish’ by giving a brief description of the changes. Now it’s live for all the users on your production server (or staging wherever the GTM Id is used).