Javascript tracker custom variables on trackPageView

HI,

Is it possible to add custom variables on trackPageView, i can’t find infos about it in the doc ?

Why is it not possible to do snowplow(‘setFoo’, ‘bar’); ?

thx

Hi @gmpetrov

In order to track custom variables using the Javascript tracker you can use custom schemas as follows. The example below is from the Javascript tracker documentation.

window.snowplow_name_here('trackPageView', null, [{
    schema: "iglu:com.example_company/page/jsonschema/1-2-1",
    data: {
        pageType: 'test',
        lastUpdated: new Date(2014,1,26)
    }
},
{
    schema: "iglu:com.example_company/user/jsonschema/2-0-0",
    data: {
      userType: 'tester'
    }
}]);

Hi mike, thx for the quick reply !

I didn’t succeed to inject data with your code sample, maybe i’m not using custom contexts well :frowning:
I’m debugging by logging the query parameters in my endpoint server.

Do you have an idea why it’s not working ?

Hi @gmpetrov - can you confirm what type of Snowplow pipeline you are running - AWS batch, AWS real-time, Kafka real-time or Snowplow Mini? That will help us to help you diagnose the problem.

Hi @alex, i’m not using any of those pipeline. I’m running snowplow through google cloud appengine -> pub/sub -> Dataflow

Hi @alex -

i am using snowplow with stdout output to log data as a first step, and later i will use kafka real-time if the tracking goes well :slight_smile: .
My issue is how to track buttons and try to filter them like in the customFormTracking.
Finally i am a little confused about how to set custumized events, i read the unstructedEvents documentation and still don’t understand how to set self describing JSON and my own Iglu repo.

Thanks

Hi @Hatem_ben - please create a new thread, it’s not fair to jump into @gmpetrov’s.

Hi @gmpetrov - for obvious reasons, we can’t provide support on a port of Snowplow that we haven’t written! The good news is that we are working on a port of Snowplow to Google Cloud Platform - we should be publishing an RFC on this soon, with code to follow afterwards.

Hi @alex,i understand, but i’m sure i’m just doing a noobie mistake ! Moreover my problem is occurring browser’s side. If you have any ideas why i can’t pass a custom variable to my server endpoint, please let me know :slight_smile:

Ok my problem is resolved.
The data passed in the custom context is then base64 encoded under the “cx” variable.
this thread helped me to solve my problem
thx

Ah great - thanks for letting us know Georges!