How to use stream-analytics - 7 common examples

To help you get started, we’ve selected a few stream-analytics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GetStream / react-activity-feed / src / Context / StreamApp.js View on Github external
constructor(props: StreamAppProps) {
    super(props);

    const client: StreamClient = stream.connect(
      this.props.apiKey,
      this.props.token,
      this.props.appId,
      this.props.options || {},
    );

    let analyticsClient;
    if (this.props.analyticsToken) {
      analyticsClient = new StreamAnalytics({
        apiKey: this.props.apiKey,
        token: this.props.analyticsToken,
      });
      analyticsClient.setUser(client.userId);
    }
    this.state = {
      client,
      user: client.currentUser,
      userData: client.currentUser.data,
      changedUserData: () => {
        this.setState({ userData: this.state.user.data });
      },
      analyticsClient,
      sharedFeedManagers: {},
      errorHandler: this.props.errorHandler,
    };
github GetStream / react-native-activity-feed / src / Context.js View on Github external
constructor(props: StreamAppProps) {
    super(props);

    let client: StreamClient = stream.connect(
      this.props.apiKey,
      this.props.token,
      this.props.appId,
      this.props.options || {},
    );

    let analyticsClient;

    if (this.props.analyticsToken) {
      analyticsClient = new StreamAnalytics({
        apiKey: this.props.apiKey,
        token: this.props.analyticsToken,
      });
      analyticsClient.setUser(client.userId);
    }
    this.state = {
      client: client,
      user: client.currentUser,
      userId: client.userId,
      userData: client.currentUser.data,
      changedUserData: () => {
        this.setState({ userData: this.state.user.data });
      },
      analyticsClient: analyticsClient,
      sharedFeedManagers: {},
      errorHandler: this.props.errorHandler,
github GetStream / Winds / api / src / utils / events / index.js View on Github external
return new Promise((resolve, reject) => {
        if (data.engagement || data.impression) {
            const analytics = new Analytics({
                apiKey: config.stream.apiKey,
                token: token,
            })

            analytics.setUser({
                alias: data.email,
                id: data.user,
            })

            if (data.engagement && !config.analyticsDisabled) {
                analytics.trackEngagement(data.engagement)
            }

            if (data.impression && !config.analyticsDisabled) {
                analytics.trackImpression(data.impression)
            }
github GetStream / Winds / api / src / utils / events / analytics.js View on Github external
import jwt from 'jsonwebtoken';
import logger from '../logger';

const token = jwt.sign(
	{
		action: '*',
		resource: '*',
		user_id: '*',
	},
	config.stream.apiSecret,
	{ algorithm: 'HS256', noTimestamp: true },
);

const noop = async () => {};

const analytics = new Analytics({
	apiKey: config.stream.apiKey,
	token: token,
});

async function trackingWrapper(fn) {
	return async args => {
		try {
			return await fn(...args);
		} catch (err) {
			logger.warn({ err });
		}
	};
}

async function TrackMetadata(key, data) {
	if (config.analyticsDisabled) {
github GetStream / Winds / api / src / utils / analytics.js View on Github external
export function getAnalyticsClient() {
	if (streamAnalyticsClient == null) {
		const token = jwt.sign(
			{
				action: '*',
				resource: '*',
				user_id: '*',
			},
			config.stream.apiSecret,
			{ algorithm: 'HS256', noTimestamp: true },
		);
		streamAnalyticsClient = new streamAnalytics({
			apiKey: config.stream.apiKey,
			token: token,
		});
	}
	return streamAnalyticsClient;
}
github GetStream / react-native-activity-feed / src / Context / StreamApp.js View on Github external
constructor(props: StreamAppProps) {
    super(props);

    const client: StreamClient = stream.connect(
      this.props.apiKey,
      this.props.token,
      this.props.appId,
      this.props.options || {},
    );

    let analyticsClient;
    if (this.props.analyticsToken) {
      analyticsClient = new StreamAnalytics({
        apiKey: this.props.apiKey,
        token: this.props.analyticsToken,
      });
      analyticsClient.setUser(client.userId);
    }
    this.state = {
      client,
      user: client.currentUser,
      userData: client.currentUser.data,
      changedUserData: () => {
        this.setState({ userData: this.state.user.data });
      },
      analyticsClient,
      sharedFeedManagers: {},
      errorHandler: this.props.errorHandler,
    };
github GetStream / Winds / app / src / index.js View on Github external
import App from './App';
import React from 'react';
import ReactDOM from 'react-dom';
import Raven from 'raven-js';
import stream from 'getstream';
import StreamAnalytics from 'stream-analytics';

import config from './config';

Raven.config(config.sentry, {
	release: config.version,
}).install();

window.streamClient = stream.connect(config.stream.apiKey, null, config.stream.appID);

window.streamAnalyticsClient = new StreamAnalytics({
	apiKey: config.stream.apiKey,
	token: config.stream.analyticsKey,
});

Raven.context(() => {
	ReactDOM.render(, document.getElementById('root'));
});

stream-analytics

Analytics JS client for GetStream.io.

MIT
Latest version published 1 year ago

Package Health Score

52 / 100
Full package analysis

Popular stream-analytics functions