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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@codeqr/analytics

v0.2.1

Published

`@codeqr/analytics` allows you to track leads and sales conversions for CodeQR.

Readme

Overview

@codeqr/analytics allows you to track leads and sales conversions for CodeQR.

Quick start

  1. Enable conversion tracking for your CodeQR link.
  2. Install the @codeqr/analytics package to your project
npm install @codeqr/analytics
  1. Inject the Analytics script to your app
import { Analytics as CodeQRAnalytics } from '@codeqr/analytics/react';

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body>{children}</body>
      <CodeQRAnalytics />
    </html>
  );
}

You can all use the inject() function to add the tracking script to other frameworks.

Available Props

You can pass the following props to the Analytics component to customize the tracking script.

apiHost

The API host to use for tracking. This is useful for setting up reverse proxies to avoid adblockers. The default is https://api.codeqr.io.

domainsConfig

This is a JSON object that configures the domains that CodeQR will track.

  • refer: The CodeQR short domain for referral program client-side click tracking (previously shortDomain).
  • site: The CodeQR short domain for tracking site visits.
  • outbound: An array of domains for cross-domain tracking. When configured, the existing cq_id cookie will be automatically appended to all outbound links targeting these domains to enable cross-domain tracking across different applications.

shortDomain

[DEPRECATED: use domainsConfig.refer instead] The custom short domain you're using on CodeQR for your short links (for client-side click tracking).

attributionModel

Decide the attribution model to use for tracking. The default is last-click.

  • first-click - The first click model gives all the credit to the first touchpoint in the customer journey.
  • last-click - The last click model gives all the credit to the last touchpoint in the customer journey.

cookieOptions

The cookieOptions prop accepts the following keys:

| Key | Default | Description | Example | |----------|---------|-------------|---------| | domain | null | Specifies the value for the Domain Set-Cookie attribute. | example.com | | expires | 90 days from now | Specifies the Date object to be the value for the Expires Set-Cookie attribute. | new Date('2024-12-31') | | expiresInDays | 90 | Specifies the number (in days) to be the value for the Expires Set-Cookie attribute. | 90 | | path | / | Specifies the value for the Path Set-Cookie attribute. By default, the path is considered the "default path". | / |

For example, to set a 60-day cookie window, you can use the following code:

import { Analytics as CodeQRAnalytics } from "@codeqr/analytics"

<CodeQRAnalytics
   cookieOptions={{
      expiresInDays: 60,
   }}
/>

queryParam

The query parameter to listen to for client-side click-tracking (e.g. ?via=john, ?ref=jane). The default is via.

scriptProps

Custom properties to pass to the script tag. Refer to MDN for all available options.

autoConvert

Opt-in automatic form-submit capture. When enabled, the script listens for form submissions and fires a lead conversion event without any custom JavaScript. Requires a publishableKey to be set.

<CodeQRAnalytics
  publishableKey="pk_live_..."
  autoConvert={{ forms: true }}
/>

Opting in per-form

By default, automatic capture is off for every form. To enable it, either:

  • Add a data-codeqr-conversion attribute to the specific <form> element you want to capture, or
  • Pass a CSS selector via autoConvert.formSelector (e.g. formSelector: "form.contact-form") to allowlist matching forms globally.

Forms that match neither criterion are ignored.

Opting out per-form

To exclude a specific form even when it would otherwise be captured (e.g. because it matches autoConvert.formSelector), add data-codeqr-ignore to the <form> element:

<form data-codeqr-ignore>...</form>

Default fields captured

By default, only identity fields are captured: email, name (first/last/full), and phone. The email address is used as the externalId for deduplication; when no email or phone is present, an anonymous identifier is generated.

Capturing additional metadata

To include extra form fields as conversion metadata:

  • Set autoConvert.captureAllFields: true to capture all non-sensitive fields from every matched form, or
  • Add data-codeqr-capture to individual <input> / <select> / <textarea> elements to opt those fields in:
<form data-codeqr-conversion>
  <input name="email" type="email" />
  <input name="company" type="text" data-codeqr-capture />
</form>

Always-excluded fields

The following are never captured regardless of any configuration or attribute:

  • Inputs of type="password", type="hidden", or type="file"
  • Fields with autocomplete="one-time-code" or an autocomplete value starting with cc-
  • Fields whose name/id/placeholder/label matches credit-card patterns: card number, expiry, cvv/cvc/ccv, security code, amex, mastercard
  • Fields whose name/id/placeholder/label matches one-time-passcode patterns: otp, one-time code/password/pin, verification code/token/pin, passcode, 2fa, mfa
  • Any value that passes a Luhn credit-card checksum
  • Any field, or a field inside an element, marked data-codeqr-ignore

Consent

Load the analytics snippet after the user has given consent (e.g. inside your cookie-consent callback). Automatic form capture only activates once the script is present on the page — deferring the script load is the recommended way to honour consent requirements.