1.1.4 • Published 5 months ago

@getpimms/analytics v1.1.4

Weekly downloads
-
License
MPL-2.0
Repository
github
Last release
5 months ago

@getpimms/analytics

Easily track and optimize your lead and sales conversions using PIMMS across multiple channels and applications.

Overview

@getpimms/analytics provides a streamlined way to implement conversion tracking on your site or application, helping you identify exactly what generates your leads and conversions.

Quick Start

Follow these steps to quickly integrate PIMMS analytics:

1. Enable Conversion Tracking

Activate conversion tracking for your PIMMS links via the PIMMS dashboard.

2. Install the Analytics Package

Add the @getpimms/analytics package to your project:

npm install @getpimms/analytics

3. Inject the Analytics Script

Integrate the tracking script into your application:

React Example:

import { Analytics as PimmsAnalytics } from '@getpimms/analytics/react';

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

Alternatively, for other frameworks, use the inject() method.

Available Props

Customize the analytics script by passing props to the Analytics component:

apiHost

Defines a custom API host for tracking requests. Useful when using reverse proxies to bypass ad-blockers.

  • Default: https://api.pimms.io

domainsConfig

Configure domains for accurate tracking:

<PimmsAnalytics
  domainsConfig={{
    site: "pim.ms",
    outbound: ["yourdomain.com", "anotherdomain.com"],
  }}
/>
  • site: Short domain provided by PIMMS.
  • outbound: Array of domains enabling cross-domain tracking.

attributionModel

Defines which touchpoint receives conversion credit:

  • Default: last-click

Available options:

  • first-click: Credits the initial user interaction.
  • last-click: Credits the final user interaction.

Example:

<PimmsAnalytics attributionModel="first-click" />

cookieOptions

Customize the cookie behavior for tracking:

KeyDefaultDescriptionExample
domainnullDomain scope of the cookieexample.com
expires90 days from nowExplicit expiry datenew Date('2024-12-31')
expiresInDays90Number of days before the cookie expires60
path/URL path the cookie applies to/

Example (set a 60-day cookie lifespan):

<PimmsAnalytics cookieOptions={{ expiresInDays: 60 }} />

queryParam

Specifies the URL parameter to use for tracking (e.g., referral codes):

  • Default: via

Example:

?ref=john_doe

To use ref instead of the default:

<PimmsAnalytics queryParam="ref" />

scriptProps

Custom attributes for the injected <script> tag. See MDN documentation for all available options.

Example:

<PimmsAnalytics scriptProps={{ defer: true }} />

Next Steps

Sign up for PIMMS today →

Introduction to conversion tracking | blog →

1.1.4

5 months ago

1.1.3

6 months ago

0.0.30

8 months ago

0.0.28

8 months ago

0.0.27

8 months ago