Hello,
I’ve been reading through this to understand mobile trackers v2.0. All seems fairly straightforward.
When I did the Javascript implementation within the page_view event I added some dynamic contexts whose output somewhat looks like this:
window.snowplow('trackPageView', null, [{
schema: 'iglu:com.mycompany.iglu/my_ids/jsonschema/1-0-0',
data: {
aid: '1234',
bid: '5678',
cid: '0987',
did: '654',
eng: 'Foxtrot',
engv: '2.3.1'
}
},
{
schema: 'iglu:com.mycompany.iglu/uniq_name/jsonschema/1-0-0',
data: {
uniq_name: "Search"
}
}],
);
For Screen_View on Native how is this achieved like for like or similar?
Thanks
Kyle
Hi @kfitzpatrick,
I’m glad you are experimenting our new version of the mobile trackers.
You can add custom contexts to the event when you create the event.
This part, is not changed with the new version so it’s a bit more complex.
Here a Swift example:
let event = ScreenView(name: "screen", screenId: nil)
event.contexts.add(
SelfDescribingJson(schema: "iglu:com.mycompany.iglu/my_ids/jsonschema/1-0-0", andDictionary: [
"aid": "1234",
"bid": "5678",
"cid": "0987",
"did": "654",
"eng": "Foxtrot",
"engv": "2.3.1"
])!)
event.contexts.add(
SelfDescribingJson(schema: "iglu:com.mycompany.iglu/uniq_name/jsonschema/1-0-0", andDictionary: [
"uniq_name": "Search"
])!)
tracker.track(event)
Here a Java example:
ScreenView event = new ScreenView("screen", null);
event.customContexts.add(
new SelfDescribingJson("iglu:com.mycompany.iglu/my_ids/jsonschema/1-0-0",
new HashMap<String, String>() {{
put("aid", "1234");
put("bid", "5678");
put("cid", "0987");
put("did", "654");
put("eng", "Foxtrot");
put("engv", "2.3.1");
}})
);
event.customContexts.add(
new SelfDescribingJson("iglu:com.mycompany.iglu/uniq_name/jsonschema/1-0-0",
new HashMap<String, String>() {{
put("uniq_name", "Search");
}})
);
tracker.track(event);
1 Like
@Alex_Benini Thank you kindly, this is of great help.
1 Like