Jorge Zamora

Jorge Zamora

Data Analytics & CRO Web

Advanced Google Tag Manager(GTM) options and your application

Tuesday July 17th, 2018

En este post vamos a hablar sobre el uso de las opciones avanzadas de Google Tag Manager y su aplicación para la resolución de errores, más específicamente sobre fallos en la inserción de píxeles de conversión para un formulario de contacto.

Para que entendamos este artículo asumimos que que somos conocedores de GTM de su uso para el control de los tags de tu sitio web.  GTM nos permite controlar los píxeles de una web a través de un sencillo contenedor de manera simple y autónoma. Pero esto no significa que nosotros no vayamos a tener errores. Echa un vistazo al siguiente ejemplo.

Una vez hemos generado las dos piezas de código necesarias en todas las páginas que nos ayuda a medir eventos deseados. Este fragmento aparecería así:

and a second fragment is an event pixel that helps us to measure specific actions of the user and is located only in the pages that the action happens, in our case the sending of a contact form. The script will look like this:

Once we have created both tags (page view and conversion) and we check through the GTM preview that both pixels fire correctly where we have specified with our activators (this is covered in another post), we can find cases in the that the console gives us the following error:

What does this mean? Well, this is telling us that the conversion pixel (event script) has not been defined and is not collecting information. If we go to our administrator of facebook ads we can check how the pixel state tells us that there is no activity, and therefore it is not working.

Why does this happen? If, when doing the preview check, does the tag fire correctly? How can we solve it?

This happens because you are executing the conversion tag after the pageview tag. The asynchronous loading of the Java Script means that there is no order in the execution of the scripts. This is when we need to utilize  the advanced configuration of GTM, sequencing of tags, to give an order to the tags and mark when we want to fire the tag, that is, what sequence we want the tags to follow to solve the error.

What we have to do is go to the conversion tag, which is what we have to tell us to activate after the pageview tag, go to tag sequencing, within the advanced options and configure the tag to activate the tag page seen before the conversion tag does. After saving the changes, we would have to do the test again and check that the console error has disappeared and that in our Facebook ad manager the pixel is active.

Although the advanced options of labels are not used regularly, knowing their functionalities can help us to solve certain errors and be very useful in many occasions.