better-attribution
Using this package
import { betterAttribution, DefaultQueryParams } from "better-attribution";
const { storeAttributionValues, getLastTouch, getFirstTouch } =
betterAttribution();
storeAttributionValues();
const lastParams = getLastTouch();
const firstParams = getFirstTouch();
betterAttribution({
queryParams: [...DefaultQueryParams, "custom_known_query_param"],
cookiePrefix: "custom_prefix",
domain: "example_2.com",
});
Features:
- Uses cookies to store visitors query params and the referrer for attribution tracking
- Exposes methods to retrieve the last and first touch attribution data
- Allows you to override collected query params
- Allows you to submit to your analytics platform or on form submissions additional info about how the user found your site for the first and most recent time.
- Enables MMM (marketing mix modeling) // MTA (multi-touch attribution)
- Tracks the document referrer
Default list of tracked query params (you can override this in the setup function):
- utm_source
- utm_medium
- utm_campaign
- utm_content
- utm_name
- utm_term
- fbclid
- ad_id
- gclid
- gc_id
Install
npm i better-attribution
License
MIT