var snowplow = require(’@snowplow/node-tracker’);
async function track (category,element) {
var gotEmitter = snowplow.gotEmitter;
var tracker = snowplow.tracker;
const e = gotEmitter(
host, // Collector endpoint
'http', // Optionally specify a method - http is the default
null, // Optionally specify a port 443
'POST', // Method - defaults to GET
1 // Only send events once n are buffered. Defaults to 1 for GET requests and 10 for POST requests.
);
const t = tracker([e], 'SnowplowTracker', 'Gen', false);
var res = t.track(snowplow.buildSelfDescribingEvent({
event: {
schema: schema-url,
data: {
event_name: "test1",
category: category,
member: element,
codebase: "xyz"
}
}
}));
return res;}
output on console ::
console output is ::
{
“statusCode”: 200,
“body”: {
“e”: “ue”,
“eid”: “7c41b623-52c9-46d9-9a4f-f1615d93b955”,
“p”: “srv”,
“tv”: “node-3.1.6”,
“tna”: “SnowplowTracker”,
“aid”: “LeadGen”,
“dtm”: “1654521339584”,
“ue_pr”: “schema-with-data”,
“stm”: “1654521339585”
}
}
but the data never seen in visualization tool, version that i’m using “@snowplow/node-tracker”: “^3.1.6”