At Stormly we make it easy for you to integrate with Google Tag Manager, while allowing you to fully customize what you track.
Here's how to get started with tracking custom events using GTM.
First create a custom tag, by follow the steps below:
Stormly – General Library – All Pages
Custom HTML
Setup Data
on the current project. The code looks something like this:
<script type="text/javascript">(function(e,t,n,r,i,s,o){e["StormlyObject"]=i;e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},s=t.createElement(n),o=t.getElementsByTagName(n)[0];s.async=1;s.src=r;o.parentNode.insertBefore(s,o)}) (window,document,"script","//cdn.stormly.com/assets/tracking/t.js","stormly"); stormly("create", "YOUR_STORMLY_KEY", {domain: "tt7bxiq.t.stormly.com", anonymizeIP: false, pageviewTracking: true, clickTracking: true, storeOnlyOneCookie: true}); </script>
Once per Page
All Pages
default trigger
When you use frontend libraries like React or Vue, there are no individual pageview loads in the sense of a complete page reloading on navigation your app.
To automatically track pageviews whenever the browser history changes, use the following steps:
_type: pageview
, you will have to go ahead and apply the following change: Go back to custom tag created above, edit the Custom HTML and replace pageviewTracking: true
to pageviewTracking: false
Custom HTML
<script type="text/javascript">stormly('pageview');</script>
Advanced settings
> Tag sequencing
and select the Stormly library to fire before "Stormly - Pageview - History Change".Our automatic tracking takes care of the majority of tracking. But in case you'd like to track additional custom events and properties, you can use the following steps:
The next step is to track the actual behavior events. In the example below, we will trigger a tracking event on a link click.
Triggers
from the left menu in tag managerJust Links
Page path
and Click ID
have to be customized to your own page structure and element IDs:Now we will create the link click tag, that will send data to Stormly. Follow the steps below to create the tag.
<script>stormly("event", "Item Read More", {category: "tutorial", words: 800});</script>
Advanced settings
> Tag sequencing
and select the Stormly library to fire before the event tag.Today
, otherwise no results are available
Repeat this process for all other event behaviors that you'd to track, and you're set!
Note: Tracked data becomes available in Stormly within seconds usually, but new projects become "active" only once at least 50 unique users are tracked.
There are two other tracking functions that you can use, but are not required:
<script>stormly("set", {favoriteColor: "blue", favoriteHolidayDestination: "Spain"});</script>
<script>stormly("identify", "user-12345");</script>