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

@aftership/web-pixels

v0.2.2-alpha.4

Published

AfterShip Web Pixels for data anaylsis

Readme

What is AfterShip Pixel Web SDK

AfterShip Pixel is a powerful tool for marketing campaign optimization and analytics with a strong commitment to data science. The AfterShip Pixel Web SDK and API make it simple to integrate.

Getting started

Begin using AfterShip Pixel APIs with a few simple steps. Log in, get your API credentials, and start developing.

Get Pixel ID

Currently, Pixel ID is available only to whitelisted users. Contact us to obtain one.

Install

AfterShip provides two common integration methods in web development. Depending on how your store is deployed, you can choose one of them to quickly integrate AfterShip Pixel into your store.

Using npm or yarn or pnpm or bun (Recommend)

$ npm install @aftership/web-pixels --save

or

$ yarn add @aftership/web-pixels

Add the AfterShip Pixel snippet

Currently, AfterShip Pixel ID is only available to whitelisted users. Please contact us to obtain the AfterShip Pixel snippet

Report the First Event

Initialization

If you installed using Add the AfterShip Pixel snippet, you can skip this step as the snippet already calls the initialization API.

Before reporting the first event, we need to call ASPixel.init to complete the SDK initialization, allowing AfterShip Pixel to know the source of upcoming events.

If this step isn't correctly executed, subsequent events reported via Track won't reach the server.

ASPixel.init({
  pixelId:"<AfterShipPixelId>"
})

Report Events

The ASPixel.events contains a variety of semantic event methods that you can choose to bury events in the right scenarios. Each event method has an explicit typescript type.

SDK will send the request after calling ASPixel.events. Before calling this API, please make sure that your website is compliant with privacy regulations (e.g. GDPR, CCPA, etc.)

// Track search terms
ASPixel.events.clicked({
	linkUrl: "test.com",
	label: "test",
});

// Track a simpler version.
ASPixel.events.pageViewed();

Identify Users

After initializing ASPixel, you can call ASPixel.identify() to identify individual users. This method accepts customerId, and all subsequent event reports will include this customerId.

// Track search terms
// Add a customer ID
ASPixel.identify({
	customerId: 'test customerId',
});

After identifying the user, it is also possible to resetIdentity the user by calling ASPixel.resetIdentiy(). After calling this,all events will not carry the user id.

// Track a simpler version.
// Add a user ID
ASPixel.track('$page_viewed', {
	customer_id: "e4b0f8a6c9d64a2b8e2f0c67a8d4f9e2"
});

Make a test API request

Enabling this won't report events but will print logs in the console.

Enable Debug Mode

Method: Call window.ASPixel.debug(true) in the console.

Disable Debug Mode

Method: Call window.ASPixel.debug(false) in the console.

API Basic

  1. init
  • Description: To initialize the SDK, you need to provide a pixelId to identify the store. This process is asynchronous, so be sure to handle it accordingly.
  • Parameter:
await ASPixel.init({
  pixelId:"<AfterShipPixelId>"
})
  1. events
  • Description: For the event reporting method, provide the event name along with the corresponding parameters to report the event.
  • Parameter:
ASPixel.events.pageViewed()
  1. debug
  • Description: To debug data reporting, you can call the debug method under the window.ASPixel in the console to enable the debugging environment. Once enabled, events will not call the API; they will only output the event calls in the console.
  • Parameter:
// fisrt time is open
window.ASPixel.debug()
// second time is close
window.ASPixel.debug()