Google Tag Manager Custom Template – Yandex Metrica

Last updated on November 7, 2019

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 🙂


  1. paco
    August 21, 2019

    Gracias por el aporte, pero da error al importar el archivo en tag templates.

  2. Erick
    October 23, 2019

    Hola, gracias por el aporte, tengo una duda, donde o como puedo hacer el id de seguimiento? tendrás alguna documentación que pueda segui

  3. Fanat Yandex
    November 6, 2019

    Where is the instruction in Russian?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.