The Snowplow Analytics Settings custom variable template is an official variable template for Google Tag Manager’s community template gallery.

Resource
Vendor documentation
Blog post
Gallery entry
GitHub repo

Description

The Snowplow Analytics Settings custom variable template is meant to be used with the Snowplow Analytics tag template.

With this template, you can compile a tracker configuration object, which you can then load into your Snowplow Analytics tags to avoid the need to manually enter the same tracker settings across all your tags.

Install the template

To install the template, browse to Templates in the Google Tag Manager user interface.

Under Variable Templates, click Search Gallery, and type snowplow into the gallery overlay search bar.

Click the Snowplow Analytics Settings template name, and then click Add to Workspace in the next screen. Review the permissions and click Add to finalize the import.

After importing the template, you can follow the normal process of creating a new variable in Google Tag Manager, and the Snowplow Analytics Settings template will be listed among the Custom variable types you can choose from.

Instructions

The fields in the template provide a UI for setting the tracker configuration parameters. You are thus encouraged to follow this link to understand what each individual field does.

The main caveat is that automatic cross-domain tracking using the crossDomainLinker setting does not currently work. This is because the sandboxed JavaScript of Google Tag Manager’s custom templates does not allow for processing of HTML elements.

There is a feature request submitted to Snowplow where linker could be configured with CSS selector strings instead, but until this materializes, cross-domain linking will need to be done manually with a Custom HTML tag:

<script>
  if (window.snowplow) {
    window.snowplow('crossDomainLinker', function(linkElement) {
      return !/mydomain\.com|javascript:|mailto:|tel:/.test(linkElement.href);
    });
  }
</script>

The other missing feature is the onload callback. For this, you can use a Custom HTML tag again.

<script>
  if (window.snowplow) {
    window.snowplow(function() {
      console.log('Snowplow has loaded.');
    });
  }
</script>

Release notes

Date Changeset
14 May 2020 Initial release.