Greetings
I am trying to set up Snowplow by using Scala Stream Collector and Stream Enrich. For the tracking part, I am testing both Python and Node.js trackers. I am running a simple “track link click” on both applications.
Turns out the Python trackers work fine, with the event being processed by both Kinesis streams that collect and enrich it. But when I try to run the same on Node.js, I get an error between the collector and the enricher:
“errors”:[{“level”:“error”,“message”:“error: object instance has properties which are not allowed by the schema: [“headers”]\n level: “error”\n schema: {“loadingURI”:”#",“pointer”:""}\n instance: {“pointer”:""}\n domain: “validation”\n keyword: “additionalProperties”\n unwanted: [“headers”]\n"},{“level”:“error”,“message”:“error: object has missing required properties ([“schema”])\n level: “error”\n schema: {“loadingURI”:”#",“pointer”:""}\n instance: {“pointer”:""}\n domain: “validation”\n keyword: “required”\n required: [“data”,“schema”]\n missing: [“schema”]\n"}]
I tried changing the Iglu resolver file, I tried to use enrichments, I tried to change the event that was tracked but nothing helped. This is the app that I’m trying to run, which is just a button with a click counter. Are the trackers set up correctly?
import React, { Component } from ‘react’;
const snowplow = require(‘snowplow-react-native-tracker’);
export default class App extends Component {
constructor(props) {
super(props);
var emitter = snowplow.Emitter;
var tracker = snowplow.Tracker;
const e = emitter(
{
endpoint: '0.0.0.0:8080', // Collector endpoint
protocol: 'http', // Optionally specify a method - http is the default
method: 'POST', // Method - defaults to GET
bufferSize: 1, // Only send events once n are buffered. Defaults to 1 for GET requests and 10 for POST requests.
},
(response) => {
console.log(response);
},
);
global.t = tracker({ emitters: [e], namespace: 'namespace-x', appId: 'xyz', encodeBase64: false });
global.t.setPlatform('web');
global.t.setUserId('id_x');
// t.trackPageView('myUrl', 'myPage', 'myReferrer', 'myCustomContexts');
// t.trackStructEvent('shop', 'add-to-basket', null, 'pcs', 2);
global.t.trackScreenView('name', 'id', ['context'], 500000);
// e.flush();
}
render() {
return (
)
}
}
class Counter extends Component {
state = {
count: 0
};
handleClick = () => {
global.t.trackLinkClick(
‘http://www.findme.com’//, // URL
);
this.setState((prevState, { count }) => ({
count: prevState.count + 1
}));
};
render() {
return {this.state.count};
}
}