@searchspring/snap-tracker 0.70.1 → 0.72.0
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 +5 -53
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,61 +1,13 @@
|
|
|
1
1
|
# Snap Tracker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Snap Tracker is a core service available on each controller via `controller.tracker`. It is responsible for sending beacon events. Its class directly extends the [beacon.js](https://github.com/searchspring/beacon.js) `Beacon` class, therefore all methods and properties of the Beacon class are available on the Tracker class.
|
|
4
4
|
|
|
5
|
-
The Snap Tracker service is responsible for sending beacon events. Its class directly extends the [beacon.js](https://github.com/searchspring/beacon.js) `Beacon` class, therefore all methods and properties of the Beacon class are available on the Tracker class and are not documented below.
|
|
6
|
-
|
|
7
|
-
## Dependencies
|
|
8
|
-
|
|
9
|
-
Snap Tracker is a dependency of [@searchspring/snap-controller](https://github.com/searchspring/snap/tree/main/packages/snap-controller) <a href="https://www.npmjs.com/package/@searchspring/snap-controller"><img alt="NPM Status" src="https://img.shields.io/npm/v/@searchspring/snap-controller.svg?style=flat"></a>
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install --save @searchspring/snap-tracker
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Import
|
|
18
|
-
```typescript
|
|
19
|
-
import { Tracker } from '@searchspring/snap-tracker';
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Tracker Config
|
|
23
|
-
|
|
24
|
-
| option | description | default value | required |
|
|
25
|
-
|---|---|:---:|:---:|
|
|
26
|
-
| id | unique identifier for the tracker | track | |
|
|
27
|
-
| framework | unique identifier for the framework utilizing the tracker | snap | |
|
|
28
|
-
| mode | application mode (production, development) | production | |
|
|
29
|
-
| doNotTrack | array of TrackerEvents, used to block specific types of tracking | ➖ | |
|
|
30
|
-
| initiator | unique identifier for the beacon | beaconjs/{version} | |
|
|
31
|
-
| apis | configure various api options | | |
|
|
32
|
-
| apis.fetch | FetchAPI reference to use | window.fetch | |
|
|
33
|
-
| requesters.personalization.origin | alternative endpoint for personalization preflight api | https://{siteId}.a.searchspring.io | |
|
|
34
|
-
| requesters.beacon.origin | alternative endpoint for beacon api | https://beacon.searchspring.io/beacon/v2 | |
|
|
35
|
-
| href | set href | window.location.href | |
|
|
36
|
-
| userAgent | set userAgent | navigator.userAgent | |
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Controller usage
|
|
40
|
-
Snap Tracker is a dependency of Snap Controller and Tracker events can be invoked via the `tracker` reference of any Snap Controller.
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
const globals = { siteId: 'abc123' };
|
|
44
|
-
const tracker = new Tracker(globals);
|
|
45
|
-
const controller = new SearchController(config, {
|
|
46
|
-
...
|
|
47
|
-
tracker,
|
|
48
|
-
...
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
console.log(tracker.track.product.click === controller.tracker.track.product.click) // true
|
|
52
|
-
console.log(tracker.track.product.click === window.searchspring.tracker.track.product.click) // true
|
|
53
|
-
```
|
|
54
5
|
|
|
55
6
|
## Snap Integration Usage
|
|
56
|
-
See [Integration Tracking](https://github.com/searchspring/snap/
|
|
7
|
+
See [Integration Tracking](https://github.com/searchspring/snap/tree/main/docs/SNAP_TRACKING.md) for how and where to implement tracking events.
|
|
57
8
|
|
|
58
9
|
|
|
59
|
-
|
|
60
|
-
|
|
10
|
+
<!-- TODO: Include when beacon.js is public -->
|
|
11
|
+
<!-- ## `events` methods -->
|
|
12
|
+
<!-- See [beacon.js Tracking Events](https://github.com/searchspring/beacon.js) for a list of available events. -->
|
|
61
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searchspring/snap-tracker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.72.0",
|
|
4
4
|
"description": "Snap Tracker",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@searchspring/beacon": "0.0.44",
|
|
24
|
-
"@searchspring/snap-store-mobx": "0.
|
|
25
|
-
"@searchspring/snap-toolbox": "0.
|
|
24
|
+
"@searchspring/snap-store-mobx": "0.72.0",
|
|
25
|
+
"@searchspring/snap-toolbox": "0.72.0",
|
|
26
26
|
"deepmerge": "4.3.1",
|
|
27
27
|
"uuid": "9.0.1"
|
|
28
28
|
},
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"files": [
|
|
31
31
|
"dist/**/*"
|
|
32
32
|
],
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "737d4bd308ebbb852fe3f09b2b90f4af87bbe264"
|
|
34
34
|
}
|