Setup Clickstream Tag

How to add clickstream tracking

  1. Open the profile and select API keys tab and create an API key with permissions "clickstream:write", click add:
  2. Open your GTM (Google Tag Manager) account and create new tag, name it something like stacktome-clickstream-tag - select "Custom HTML" and copy the template below:

      <!-- Snowplow starts plowing -->
    <script type="text/javascript">
    var o =; = function(){
      var res = o.apply(this, arguments);
      var err = new Error();  
      if((arguments[1] || '').indexOf('stacktome') > 0)
        this.setRequestHeader('apikey', '{{API_KEY}}' );
      return res;
    ;(function () {
         window.snowplow('newTracker', 'cf1', '',
        { // Initialise a tracker
          appId: '{{ACCOUNT_NAME}}', // account_name that is tracked
          platform: 'web',
          cookieDomain: '{{WEBSITE_DOMAIN}}',
          sessionCookieTimeout: 3600, // one hour
          post: true,
          contexts: {
              performanceTiming: true,
              webPage: true
    <!-- Snowplow stops plowing -->
    window.snowplow('trackPageView', null , null, null);
  3. Replace placeholder values for
    - {{API_KEY}} - API key with clickstream:write permisions
    - {{ACCOUNT_NAME}} - the account name in profile
    - {{WEBSITE_DOMAIN}}  - with your website domain, e.g.
  4. Once the tracker is set you can verify if clickstream events get sent by using this extension and opening your website

Still need help? Contact Us Contact Us