Google Tag Manager allows you to quickly and easily update measurement codes and related code fragments collectively, just by adding one tracking code in your web. It’s a pretty common system to manage your website analytics.
User Stories
As a Frontity user
I want to use Google Tag Manager in my project
so that I can manage all my analytics collectively
Hey, I just wanted to ask if you agree with the format of pageviews and events that are currently sending to Google Tag Manager, because I think we can improve it a bit.
Well, I’m not completely sure about it. It’s true that this package uses the analytics package underneath but GTM could do more things appart from analytics stuff.
@SantosGuillamot what do you think we should do, stick with @frontity/google-tag-manager or change it for @frontity/gtm-analytics or @frontity/google-tag-manager-analytics?
As @david said, it’s true that GTM is more than analytics. But on the other hand, this package is built on top of @frontity/analytics and uses the analytics namespace (i.e. people installing this package will have to use actions.analytics.event() to send events).
I am testing this package but can’t seem to get events to fire. Tested both click events and all page load events. It seems the issue is that there is a default filter:
This event never seems to trigger so even when other events are satisfied, no tags are called.
On the variable display in the Frontity app, there are 3 _events: virtualPageview, gtm.load and gtm.dom.
On another property I have (with GTM working), I looked at the firing events:
‘The Container Loaded’ event seems to trigger the _event = gtm.js filter.
Do we need to add a custom ‘Content Loaded’ event to Frontity in order to get these to run? It seems all future tags are reliant upon having the filter _event = gtm.js passed.
@ddrager be aware that we don’t consider the API of the package stable yet and it’s going to change once we publish the final version of the package, which if I’m not mistaken should be in the upcoming weeks. We will post information in this thread once that happens
Because I want to finish this and not to continue with more changes!
Anyways, what do you think about the format I proposed for pageviews? The only thing that still doesn’t seem to fit for me is the event name. Could it be something as general as "pageview"? Or should it be more Frontity-specific, like "frontityPageview"? Or something different?
The first stable version for the @frontity/google-tag-manager-analytics package is ready!
Here is a summary of the changes we did:
The package was renamed from @frontity/google-tag-manager to @frontity/google-tag-manager-analytics to remark that it belongs to the Frontity analytics group of packages.
It now uses the new version of the analytics library under the hood.
Settings haven’t changed, but the format used to add pageviews to the Google Tag Manager’s data layer has. Now it is as follows:
dataLayer.push({
event: "pageview",
title: "The Beauties Of Gullfoss - Frontity Test",
link: "/2016/the-beauties-of-gullfoss/",
});
Users updating this package to the new version have to update their triggers and tags in their GTM containers in order to match the new format.