🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@amplitude/plugin-web-attribution-browser

Package Overview
Dependencies
Maintainers
21
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplitude/plugin-web-attribution-browser

2.1.53
Source
npm
Version published
Weekly downloads
130K
-16.91%
Maintainers
21
Weekly downloads
 
Created
Source


@amplitude/plugin-web-attribution-browser

Official Browser SDK plugin for web attribution tracking

Installation

This package is published on NPM registry and is available to be installed using npm and yarn.

# npm
npm install @amplitude/plugin-web-attribution-browser

# yarn
yarn add @amplitude/plugin-web-attribution-browser

Usage

This plugin works on top of Amplitude Browser SDK and adds web attribution tracking features to built-in features. To use this plugin, you need to install @amplitude/analytics-browser version v2.0.0 or later.

1. Import Amplitude packages

  • @amplitude/plugin-web-attribution-browser
import { webAttributionPlugin } from '@amplitude/plugin-web-attribution-browser';

2. Instantiate page view plugin

The plugin accepts an optional parameter of type Object to configure the plugin based on your use case.

const webAttributionTracking = webAttributionPlugin(amplitude, {
  excludeReferrers: undefined,
  initialEmptyValue: undefined,
  resetSessionOnNewCampaign: undefined,
});

Options

NameTypeDefaultDescription
excludeReferrers(string | RegExp)[][]Use this option to prevent the plugin from tracking campaigns parameters from specific referrers. For example: subdomain.domain.com.
initialEmptyValuestring"EMPTY"Use this option to specify empty values for first-touch attribution.
resetSessionOnNewCampaignbooleanfalseUse this option to control whether a new session should start on a new campaign.

3. Install plugin to Amplitude SDK

amplitude.add(webAttributionTracking);

4. Initialize Amplitude SDK

amplitude.init('API_KEY');

Resulting web attribution event

This plugin tracks campaign parameters based on your configuration. A web attribution event is composed of the following values:

Event type

  • "$idenfity"

User properties

PropertyDescription
utm_sourceURL query parameter value for utm_source
utm_mediumURL query parameter value for utm_medium
utm_campaignURL query parameter value for utm_campaign
utm_termURL query parameter value for utm_term
utm_contentURL query parameter value for utm_content
referrerReferring webstite or document.referrer
referring_domainReferring website's domain, including subdomain
dclidURL query parameter value for dclid
gbraidURL query parameter value for gbraid
gclidURL query parameter value for gclid
fbclidURL query parameter value for fbclid
ko_click_idURL query parameter value for ko_click_id
li_fat_idURL query parameter value for li_fat_id
msclkidURL query parameter value for msclkid
rtd_cidURL query parameter value for rtd_cid
ttclidURL query parameter value for ttclid
twclidURL query parameter value for twclid
wbraidURL query parameter value for wbraid

FAQs

Package last updated on 03 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts