@amplitude/plugin-web-attribution-browser 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://amplitude.com" target="_blank" align="center">
|
|
3
|
+
<img src="https://static.amplitude.com/lightning/46c85bfd91905de8047f1ee65c7c93d6fa9ee6ea/static/media/amplitude-logo-with-text.4fb9e463.svg" width="280">
|
|
4
|
+
</a>
|
|
5
|
+
<br />
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
# @amplitude/plugin-web-attribution-browser
|
|
9
|
+
|
|
10
|
+
Official Browser SDK plugin for web attribution tracking
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
This package is published on NPM registry and is available to be installed using npm and yarn.
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
# npm
|
|
18
|
+
npm install @amplitude/plugin-web-attribution-browser
|
|
19
|
+
|
|
20
|
+
# yarn
|
|
21
|
+
yarn add @amplitude/plugin-web-attribution-browser
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
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 `v1.4.0` or later.
|
|
27
|
+
|
|
28
|
+
### 1. Import Amplitude packages
|
|
29
|
+
|
|
30
|
+
* `@amplitude/analytics-browser`
|
|
31
|
+
* `@amplitude/plugin-web-attribution-browser`
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import * as amplitude from '@amplitude/analytics-browser';
|
|
35
|
+
import { webAttributionPlugin } from '@amplitude/plugin-web-attribution-browser';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Instantiate page view plugin
|
|
39
|
+
|
|
40
|
+
The plugin requires 1 parameter, which is the `amplitude` instance. The plugin also accepts an optional second parameter, which is an `Object` to configure the plugin based on your use case.
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
const webAttributionTracking = webAttributionPlugin(amplitude, {
|
|
44
|
+
disabled: undefined,
|
|
45
|
+
excludeReferrers: undefined,
|
|
46
|
+
initialEmptyValue: undefined,
|
|
47
|
+
resetSessionOnNewCampaign: undefined,
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### Options
|
|
52
|
+
|
|
53
|
+
|Name|Type|Default|Description|
|
|
54
|
+
|-|-|-|-|
|
|
55
|
+
|`disabled`|`boolean`|`false`|Use this option to enable or disable web attribution tracking. By default, upon installing this plugin, web attribution tracking is enabled.|
|
|
56
|
+
|`excludeReferrers`|`string[]`|`[]`|Use this option to prevent the plugin from tracking campaigns parameters from specific referrers. For example: `subdomain.domain.com`.|
|
|
57
|
+
|`initialEmptyValue`|`string`|`"EMPTY"`|Use this option to specify empty values for [first-touch attribution](https://www.docs.developers.amplitude.com/data/sdks/marketing-analytics-browser/#first-touch-attribution).|
|
|
58
|
+
|`resetSessionOnNewCampaign`|`boolean`|`false`|Use this option to control whether a new session should start on a new campaign.|
|
|
59
|
+
|
|
60
|
+
### 3. Install plugin to Amplitude SDK
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
amplitude.add(webAttributionTracking);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 4. Initialize Amplitude SDK
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
amplitude.init('API_KEY');
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Resulting web attribution event
|
|
73
|
+
|
|
74
|
+
This plugin tracks campaign parameters based on your configuration. A web attribution event is composed of the following values:
|
|
75
|
+
|
|
76
|
+
#### Event type
|
|
77
|
+
* `"$idenfity"`
|
|
78
|
+
|
|
79
|
+
#### User properties
|
|
80
|
+
|
|
81
|
+
|Property|Description|
|
|
82
|
+
|-|-|
|
|
83
|
+
|`utm_source`|URL query parameter value for `utm_source`|
|
|
84
|
+
|`utm_medium`|URL query parameter value for `utm_medium`|
|
|
85
|
+
|`utm_campaign`|URL query parameter value for `utm_campaign`|
|
|
86
|
+
|`utm_term`|URL query parameter value for `utm_term`|
|
|
87
|
+
|`utm_content`|URL query parameter value for `utm_content`|
|
|
88
|
+
|`referrer`|Referring webstite or `document.referrer`|
|
|
89
|
+
|`referring_domain`|Referring website's domain, including subdomain|
|
|
90
|
+
|`dclid`|URL query parameter value for `dclid`|
|
|
91
|
+
|`gbraid`|URL query parameter value for `gbraid`|
|
|
92
|
+
|`gclid`|URL query parameter value for `gclid`|
|
|
93
|
+
|`fbclid`|URL query parameter value for `fbclid`|
|
|
94
|
+
|`ko_click_id`|URL query parameter value for `ko_click_id`|
|
|
95
|
+
|`msclkid`|URL query parameter value for `msclkid`|
|
|
96
|
+
|`ttclid`|URL query parameter value for `ttclid`|
|
|
97
|
+
|`twclid`|URL query parameter value for `twclid`|
|
|
98
|
+
|`wbraid`|URL query parameter value for `wbraid`|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/plugin-web-attribution-browser",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Amplitude Inc",
|
|
6
6
|
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"files": [
|
|
54
54
|
"lib"
|
|
55
55
|
],
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "b1cf8c7d08e265ac733f5a775acf65da361dbe7b"
|
|
57
57
|
}
|