Socket
Socket
Sign inDemoInstall

@apollosproject/ui-analytics

Package Overview
Dependencies
1
Maintainers
4
Versions
457
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @apollosproject/ui-analytics

## Configuration


Version published
Weekly downloads
829
decreased by-35.69%
Maintainers
4
Install size
3.52 MB
Created
Weekly downloads
 

Changelog

Source

4.2.0 (2022-07-15)

Features

Bug Fixes

Readme

Source

Apollos UI: Analytics

Configuration

There is one configuration option available with this PR. You can add additional third party tracking libraries that are triggered anytime a track event from this library is triggered.

When implementing your provider, set the trackFunctions prop. For example, like this:

  <AnalyticsProvider trackFunctions={[console.warn]}>
    <Providers {...props} />
  </AnalyticsProvider>

This will call the console.warn function every time the analytics calls track. The properties passed are {eventName: String, properties: Object }.

You can do the same for identify using identifyFunctions. You must always pass an array of functions, even if you are only passing a single function.

Usage

From anywhere you have access to your apollo client variable...

import { track } from '@apollosproject/ui-analytics'

...

  track({ client, eventName, properties });

From anywhere in the component tree under the AnalyticsProvider.

import { AnalyticsConsumer } from '@apollosproject/ui-analytics'

...

  <AnalyticsConsumer>
  ({ track, identify }) => (
    <Something onSomethingHappened={() => track({ eventName, properties })} />
  )
  </AnalyticsConsumer

Using a component.

import { TrackEventWhenLoaded } from '@apollosproject/ui-analytics'

...

  <TrackEventWhenLoaded eventName="Something" properties={...someData} loaded={this.props.loaded} />

Keywords

FAQs

Last updated on 15 Jul 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc