Google Tag Manager Custom Template - Yandex Metrica


Table Of Contents

It's been a while since my last post ( Shame on me!) , but the new Custom Templates feature has been a great addition to Google Tag Manager the last week.

If you don't know what the Custom Templates are, please do yourself a favor and read Simo Ahava's great guide on them.

I've been playing the last days with this new feature, trying to build a more complex template, so I decided to try to implement a full Yandex Metrica Custom Template for Google Tag Manager.

What's supported:

Method ( track types )

  • Init
  • Outbound links ( Fields: URL )
  • File Downloads ( Fields: URL , Referrer )
  • Reach Goals ( Fields: Target, Order Price, Currency )
  • Hit ( Fields: URL, Referrer, Title )
  • User Id ( Fields: User Id )
  • Session Pameters ( Fields : Parameters Map )
  • User Parameters ( Fields : Parameters Map )
  • Not Bounces

Tracking features supported on the tracker:

  • Enabling/Disabling default Data Sending ( default pageview, useful for SPA Sites )
  • Enabling Hash Tracking
  • Disabling sending pages to Yandex Index
  • Loading the Script library from the alternative CDN
  • Enabling/Disabling Accurate Track Bounce tracking
  • Enabling/Disabling Click Maps tracking
  • Enabling/Disabling Track Links ( including extensions personalization)
  • Enabling/Disabling Webvisor
  • Enabling Disabling the Debugging Cookie
  • Ecommerce Tracking ( data layer variable name can be personalized )

I've included some advanced features ( I'm new to Yandex Metrica, so I had no time to properly test them yet )

  • Debug Mode can be enabled from Init Tag without the need of setting up a QueryString parameter

Upcoming features

  • Callbacks support
  • Code improvements/comments

You can get the template from the following URL:

ChangeLog 14 June 2019

  • Fixed Ecommerce Setup . It was not being initilized.
  • Minor UI Reorganization
  • Added Session Parameters Tracking
  • Added User Parameters Tracking
  • Added userID Tracking
  • Added not-Bounce Tracking
  • Fixed Debug being reset on after init methods



Waiting for your feedback and request :)