npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@goplayerzero/sdk-web

v0.3.0

Published

The official PlayerZero Web SDK

Readme

PlayerZero Web SDK

The PlayerZero Web SDK enables you to integrate PlayerZero into your website or web application. With this SDK, you can manage PlayerZero initialization, identify users, track custom analytics events, generate DevTools links, and more. For comprehensive API documentation, visit PlayerZero Docs.


Installation

Install the SDK using your preferred package manager:

npm

npm i @goplayerzero/sdk-web --save

with yarn

yarn add @goplayerzero/sdk-web

Initialize the SDK

Calling init() more than once after successful initialization will trigger console warnings. To check if PlayerZero has already been initialized, use PlayerZero.isInitialized().

PlayerZero API

  • PlayerZero.init(apiToken: string, options: {endpoint?: string, privacyFnUrl?: string}) - Initialize PlayerZero with your API Token and optional configuration. The API Token can be found on PlayerZero's Project Settings under the Web SDK area.
  • PlayerZero.isInitialized(): Boolean - Returns true if PlayerZero is initialized.
  • PlayerZero.identify(userId: string, metadata: Record<string, unknown>) - Identify the current user and associate metadata.
  • PlayerZero.setUserVars(metadata: Record<string, unknown>) - Update user properties and metadata without resetting the identity.
  • PlayerZero.track(event: string, metadata?: Record<string, unknown>) - Track a custom analytics event with optional metadata.
  • PlayerZero.prompt() - Prompt the user to interact with their DevTools report.
  • PlayerZero.devtoolsUrl(): Promise<string> - Generate a DevTools URL for the current session.
  • PlayerZero.kill() - Immediately shut down PlayerZero. This action is irreversible for the session.

Examples

React

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import PlayerZero from '@goplayerzero/sdk-web';

PlayerZero.init('<your project id here>');

ReactDOM.render(<App/>, document.getElementById('root'));

Angular - main.ts

import { Component } from '@angular/core';
import PlayerZero from '@goplayerzero/sdk-web';
import { environment } from '../environments/environment';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {

  constructor() {
    PlayerZero.init('<your project id here>');
  }
}

Vue

import Vue from 'vue';
import App from './App.vue';
import PlayerZero from '@goplayerzero/sdk-web';

PlayerZero.init('<your project id here>');
Vue.prototype.$PlayerZero = PlayerZero;

new Vue({
  render: h => h(App)
}).$mount('#app');

Vue 3

import { createApp } from 'vue'
import App from './App.vue'
import PlayerZero from '@goplayerzero/sdk-web';

PlayerZero.init('<your project id here>');

const app = createApp(App);
app.config.globalProperties.$PlayerZero = PlayerZero;
app.mount('#app');

Using the SDK

Once PlayerZero is initialized, you can make calls to the PlayerZero SDK.

Identify a User

Associate a user and their metadata with PlayerZero:

PlayerZero.identify(
  'userId',
  {
    name: 'Billy Joel',
    email: '[email protected]',
    group: 'Pied Piper'
  }
);

Track custom analytics events

Send custom events to PlayerZero for analytics:

PlayerZero.track(
  'checkout',
  { item: 'chocolate' }
);

Generate a DevTools URL

Create a DevTools URL for the current session:

PlayerZero.devtoolsUrl().then(url => console.log('PlayerZero Devtools URL', url));

Additional Information

  • For advanced configuration and troubleshooting, refer to the official documentation.
  • If you need to stop PlayerZero during a session, call PlayerZero.kill(). Note that reinitialization is not possible after calling this method.

Support

For questions or support, please contact PlayerZero Support.