New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@netlify/activity-hub

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/activity-hub

To keep track of activity across multiple Netlify properties, we need a centralized place where we can store activity.

  • 1.1.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Netlify User Activity Aggregation

To keep track of activity across multiple Netlify properties, we need a centralized place where we can store activity.

This activity is used to track progress (e.g. how much of an educational resource has been completed), determine whether someone has completed the steps to earn a community badge or other bonuses, benefits, or bragging rights.

This module is a write-only helper that makes sending activity data to the central service as painless as possible.

Installation

npm i @netlify/activity-hub

Usage

This app assumes you’ve already authenticated the user and that you have their Netlify user ID. If you need to get this, you can use Netlify OAuth and the Netlify API to retrieve it.

import netlifyActivityHub from '@netlify/activity-hub';

// this is pseudo-code; your app needs to provide the user object
const user = getNetlifyUser()

const sendActivity = netlifyActivityHub({  
  userId: user.id,
  app: "your-app-name", // use the same app name everywhere in your app
});

// whenever you want to send activity, call `sendActivity`
document.querySelector('button').addEventListener('click', () => {
  sendActivity('button-click', {
    page: window.location.pathname,
  })
});

API

netlifyActivityHub

The main function exported by @netlify/activity-hub accepts global config and returns a function that will send activity to the Activity Hub.

import netlifyActivityHub from '@netlify/activity-hub';

// see the next section for the config object’s shape
const sendActivity = netlifyActivityHub(config);
propertytypedescription
userIdstringa Netlify user ID, as returned from the Netlify API
appstringa unique identifier for your app. this can be used to group activity later

sendActivity

The function returned from netlifyActivityHub accepts an event type as a string, and an object full of arbitrary data to track whatever details you want about the activity.

sendActivity(type, data);
propertytypedescription
typestringany string to identify the activity type (e.g. start-playback)
dataobjectany JSON.stringify-able data in an object that can be attached to the activity

NOTE: don’t store any personally identifying data in the data object

FAQs

Package last updated on 22 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc