Easily track and optimize your lead and sales conversions using PIMMS across multiple channels and applications.
@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.
Follow these steps to quickly integrate PIMMS analytics:
Activate conversion tracking for your PIMMS links via the PIMMS dashboard.
Add the @getpimms/analytics package to your project:
npm install @getpimms/analyticsIntegrate 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.
Customize the analytics script by passing props to the Analytics component:
Defines a custom API host for tracking requests. Useful when using reverse proxies to bypass ad-blockers.
- Default:
https://api.pimms.io
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.
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" />Customize the cookie behavior for tracking:
| Key | Default | Description | Example |
|---|---|---|---|
domain |
null |
Domain scope of the cookie | example.com |
expires |
90 days from now | Explicit expiry date | new Date('2024-12-31') |
expiresInDays |
90 |
Number of days before the cookie expires | 60 |
path |
/ |
URL path the cookie applies to | / |
Example (set a 60-day cookie lifespan):
<PimmsAnalytics cookieOptions={{ expiresInDays: 60 }} />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" />Custom attributes for the injected <script> tag. See MDN documentation for all available options.
Example:
<PimmsAnalytics scriptProps={{ defer: true }} />