Sending custom value to name_tracker

How can we pass some ‘particular value’ to the name_tracker field. We tried doing something like this:

<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","//tracker.domain/sp.js","snowplow"));
window.snowplow('newTracker', 'cf', 'collector.domain', { 
  appId: 'APPID,
  cookieDomain: 'DOMAIN',
  trackerNamespace: 'CONSTANT'  //This is what we are using to pass custom value
  contexts: {
    webPage: true,
    performanceTiming: true,
    gaCookies: true,
    geolocation: false
  }
});
}
</script>```

But, we are not receiving anything in name_tracker column on redshift. It appears we are not experiencing any data loss.

Hi @vivek291836,

As per Tracker 2.6.1 source (https://github.com/snowplow/snowplow-javascript-tracker/blob/master/src/js/tracker.js), and I beleive in older versions, there is no trackerNamespace parameter. If you want to set a value to tracker name, set it in the second parameter of newTracker command (so window.snowplow('newTracker', 'CONSTANT'.... Note that tracker name makes relation between user events, so if you want it to vary between actions, you may lost more than you win. I would rather suggest a custom context to pass value(s) to SNowplow stack.

@grzegorzewald Thanks for your reply !
Can you elaborate on
tracker name makes relation between user events, so if you want it to vary between actions, you may lost more than you win
Also, I would like to add, for the same user constant won’t vary although different users can have different constants.

The tracker name is used in the LocalStorage variable buffering data you was unable to send. If a single user has many tracker names and issue with internet connection, on data flush you may lose time order of the events (as long as your analysis is based on collecto timestamp of course). This is rather a kind of particular case, not the default one…

There should be no issues as single user caries always the same value. I am guessing you want to vary users to filter them out?

Anyway, I do not think, tracker name was supposed to pass changing value. It is rather used to add possibility to have many trackers running in parallel. I still would suggest a custom context.

@grzegorzewald is exactly right - the tracker name is there to help distinguish between multiple instances of the Snowplow JS Tracker on a web page.

Because so many widget/analytics/advertising companies use Snowplow as part of their tech, the chance of having multiple Snowplow JS Tracker instances on a page is surprisingly high, so the namespacing is valuable.

Use a custom context if you want to attach additional data points to some or all events.

@alex @grzegorzewald Thank you for your quick and valuable responses :+1: