How we can override platform web to other value


#1

Hello There,

I am trying to set the platform: lg in my web GTM, and this change I can see in the collector log but when I am trying to see in the shredded log, platform is coming as web. so can I override the paltform value according to my business need.

<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","sp.js","snowplow"));
  console.log("Platform: "+'{{platform}}');
window.snowplow('newTracker', 'cf', 'collector.endpoint.com', { 
  appId: 'APP_ID',
  cookieDomain: 'endpoint.com',
  platform: '{{platform}}'// gtm variable {{platform}}=lg or sm or xs 
});
window.snowplow('trackPageView');
var adId = '{{ad-id}}';
  if(adId != "undefined") {
window.snowplow('trackStructEvent', 'PageView', 'Ad Details', 'Ad Id', '{{ad-id}}', '0.0');
  }
</script>

so this is my GTM tag I am overriding the platform but still in DB platform is coming as web.
so can you suggest me how I can override the platform


Distinguish between desktop and mobile traffic
#2

Hi @birju1100,

platform values are fixed right now. But there is a ticket to allow arbitrary values:
https://github.com/snowplow/snowplow/issues/2814

Christoph


#3

Thanks @christoph-buente ,

But some how I have to store some custom value in platform to distinguish our source system platform,
is there any alternative column which I can override with platform value.
and what are the field I can override pageview events.


#4

You could attach a custom context to your pageView event, which contains a JSON object with a single key/value pair like this:

{schema: "Your custom schema", data: {platform: "email"}}

And then later down your data pipeline, you need to make sure to read that information. See the iglu schema definition to make sure your schema matches your data.