diff --git a/docs/INTEGRATION_TRACKING.md b/docs/INTEGRATION_TRACKING.md
index f8c5bcd7f..47e0a7057 100644
--- a/docs/INTEGRATION_TRACKING.md
+++ b/docs/INTEGRATION_TRACKING.md
@@ -19,13 +19,15 @@ searchspring.tracker.track.shopper.login({
```
### Product View
-Tracks product page views. Should only be installed on product detail pages. A `sku` and/or `childSku` are required.
+Tracks product page views. Should only be installed on product detail pages. A `uid` and/or `sku` and/or `childSku` and/or `childUid` are required (provide as many of these product identifiers that are available).
```html
```
@@ -34,8 +36,10 @@ Alternatively, this can also be integrated using the `searchspring.tracker.track
```typescript
searchspring.tracker.track.product.view({
+ uid: '123',
sku: 'product123',
- childSku: 'product123_a',
+ childUid: '123_a',
+ childSku: 'product123_a'
});
```
@@ -43,19 +47,23 @@ searchspring.tracker.track.product.view({
### Cart View
Tracks cart contents. Should only be installed on a cart page. If the checkout process does not contain a dedicated cart page (ie. slideout cart) then this method should be invoked when the cart comes into view.
-Each item object must contain a `qty`, `price`, (`sku` and/or `childSku`)
+Each item object must contain a `qty`, `price`, (`uid` and/or `sku` and/or `childSku` and/or `childUid` - provide as many of these product identifiers that are available).
```html
diff --git a/packages/snap-preact-demo/tests/cypress/e2e/tracking/track.cy.js b/packages/snap-preact-demo/tests/cypress/e2e/tracking/track.cy.js
index 6615002dd..a4cc82b16 100644
--- a/packages/snap-preact-demo/tests/cypress/e2e/tracking/track.cy.js
+++ b/packages/snap-preact-demo/tests/cypress/e2e/tracking/track.cy.js
@@ -2,11 +2,15 @@ import { BeaconType, BeaconCategory } from '@searchspring/snap-tracker';
describe('Tracking', () => {
beforeEach(() => {
+ cy.clearCookies();
+
cy.on('window:before:load', (win) => {
win.mergeSnapConfig = {
mode: 'production',
};
});
+
+ cy.wait(1000);
});
it('tracked shopper login', () => {
cy.visit('https://localhost:2222');
@@ -89,6 +93,7 @@ describe('Tracking', () => {
expect(beacon.category).to.equal(BeaconCategory.PAGEVIEW);
expect(beacon.event).to.be.an('object').to.include.all.keys(['sku']);
+ expect(beacon.event.uid).to.equal('182146');
expect(beacon.event.sku).to.equal('C-AD-W1-1869P');
});
@@ -122,8 +127,20 @@ describe('Tracking', () => {
expect(beacon.event).to.have.property('items');
expect(beacon.event.items).to.be.an('array').to.have.length(2);
- expect(beacon.event.items[0]).to.be.an('object').include.all.keys(['sku', 'qty', 'price']);
- expect(beacon.event.items[1]).to.be.an('object').include.all.keys(['sku', 'qty', 'price']);
+ expect(beacon.event.items[0]).to.be.an('object').include.all.keys(['uid', 'sku', 'qty', 'price']);
+ expect(beacon.event.items[1]).to.be.an('object').include.all.keys(['uid', 'sku', 'qty', 'price']);
+ expect(beacon.event.items[0]).to.deep.equal({
+ uid: '182146',
+ sku: 'C-AD-W1-1869P',
+ qty: '1',
+ price: '48',
+ });
+ expect(beacon.event.items[1]).to.deep.equal({
+ uid: '174287',
+ sku: 'C-AD-Y5-814MD',
+ qty: '1',
+ price: '36',
+ });
});
cy.wait('@pixel').should((interception) => {
@@ -159,8 +176,21 @@ describe('Tracking', () => {
expect(beacon.event).to.have.property('items');
expect(beacon.event.items).to.be.an('array').to.have.length(2);
- expect(beacon.event.items[0]).to.be.an('object').include.all.keys(['sku', 'qty', 'price']);
- expect(beacon.event.items[1]).to.be.an('object').include.all.keys(['sku', 'qty', 'price']);
+ expect(beacon.event.items[0]).to.be.an('object').include.all.keys(['uid', 'sku', 'qty', 'price']);
+ expect(beacon.event.items[1]).to.be.an('object').include.all.keys(['uid', 'sku', 'qty', 'price']);
+
+ expect(beacon.event.items[0]).to.deep.equal({
+ uid: '99688',
+ sku: 'C-BP-G7-B1469',
+ qty: '1',
+ price: '22',
+ });
+ expect(beacon.event.items[1]).to.deep.equal({
+ uid: '181655',
+ sku: 'C-VJ-P2-32007',
+ qty: '1',
+ price: '39',
+ });
});
cy.wait('@pixel').should((interception) => {
diff --git a/packages/snap-tracker/README.md b/packages/snap-tracker/README.md
index 453ae0219..f35aecc98 100644
--- a/packages/snap-tracker/README.md
+++ b/packages/snap-tracker/README.md
@@ -83,7 +83,9 @@ This method will call the `retarget` method on all `DomTargeters` set in the Tra
```html
@@ -95,13 +97,17 @@ This method will call the `retarget` method on all `DomTargeters` set in the Tra