Global Context not sent


I’m integrating the JS tracker on my web site and i encounter difficulties with the addGlobalContext method.

For now, my implementation is quite simple :

<script type="text/javascript">                                                                                                                                        

  window.snowplow("newTracker", "xxxx_tracker","//", {
    appId: 'xxxx_useraccount',
    discoverRootDomain: true,
    eventMethod: 'get',
    forceSecureTracker: true,
    respectDoNotTrack: true,                                              

  window.snowplow('setDebug', true)
  window.snowplow('addGlobalContexts', [
      "data": {
        "environment" : window._Y_.environment,
  window.snowplow('enableActivityTracking', 30, 10);

I think i’m missing something here because neither in the request neither in metabase do i see my context sent. Do i really need a schema even if i don’t need to make filter on my context ? What am i doing wrong ?

Thank you very much for your help.

Hi Claire!

Your context JSON doesn’t look like Self-describing JSON - it needs to reference a schema, like so:

  schema: 'iglu:com.acme/user_context/jsonschema/1-0-0'
  data: {
    userid: ,
    name: 'john doe'

I think the easiest thing to do is first send some events with custom contexts the ‘old way’, to get used to how they’re done, then use global context once you’ve done that successfully.


I didn’t have understood right the way that a schema was required in order to attached a global context. Thank you!

1 Like