wharfdale
wharfdale

Reputation: 752

GetStream - Error when sending Analytics Engagement

I am sending data to GetStream but there is an error being returned which I have no idea where it's referring to, considering I am not sending user_id anywhere in my code.

It's when I run this which the error comes up: client.trackEngagement(engagement);. The connection to GetStream seems correct in this case as I am getting a message from them, but the data being sent is somehow wrong?

GetStream JS package - https://github.com/getstream/stream-js.
GetStream Analytics Docs - https://getstream.io/docs/analytics_engagements/?language=js

Another example setup from GetStream - https://github.com/GetStream/stream-analytics-js/blob/master/examples/index.html

Error: enter image description here

As a test, this is the code I run when the page is loaded.

Code:

const StreamAnalytics = require('stream-analytics');

// Get Stream
const client = new StreamAnalytics({
    apiKey: "abc123",
    token: "abc123"
});

client.setUser({
    alias: 'jordan'
});

// Send GetStream analytics data
engagement = {
    'label': 'like',
    'content': {
        'foreign_id': 'like:468'
    },
    'score': 80,
    'position': 3,
};

client.trackEngagement(engagement);

Upvotes: 0

Views: 72

Answers (1)

Scott Lasica
Scott Lasica

Reputation: 344

analytics are a premium feature available on Pro and Enterprise plans. If you're on one of those plans, please contact Stream support and ask for analytics to be enabled for the app you need.

Upvotes: 1

Related Questions