Can't get snowplow mini to use custom trackers

I set-up Snowplow mini to test it out and I can’t get the collector to work with custom tracking. I copied the tracker it uses internally and switched in the endpoint as describe in https://snowplowanalytics.com/blog/2016/04/08/introducing-snowplow-mini/. This gives me the following code:

<script type="text/javascript">
  ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
  p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
  };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
  n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","https://d1fc8wv8zag5ca.cloudfront.net/2.8.2/sp.js","snowplow"));
  var collector = window.location.host;
  window.snowplow('newTracker','rt','18.221.107.105:8080', {
    encodeBase64: false,
    appId: 'notsnowplowmini',
    platform: 'web',
    contexts: {
      webPage: true,
      performanceTiming: true
    }
  });
  window.snowplow('setUserId', 'NotSnowplowMini-User');
  window.snowplow('enableActivityTracking', 10, 10);
</script>
<!-- Snowplow stops plowing -->

And that doesn’t seem to work. Any ideas on what I’m doing wrong?

Hi @gmarlin,

The snippet you’ve shared doesn’t call any Track methods, which are what sends the event. The documentation for the javascript tracker has examples of doing so, I’d start with a Page View event.

If you add window.snowplow('trackPageView'); to the end of your script you should start to see events come through.

In terms of nomenclature things can get confusing - page views are classed as a standard event, since you can also set up a fully custom self-describing event. That requires creating a schema and pushing it to snowplow mini’s iglu-server (hosts schemas for Mini), which is a little more involved - there’s some software to aid in this process too.

Do let us know how you get on.

3 Likes

Wow what an oversight on my part. Thanks for the catch and for the reply. Made the change and it works. :slight_smile: