Skip to content

Commit ada98f0

Browse files
custom globals
1 parent d287e4f commit ada98f0

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

packages/connectors/datalayer/src/__tests__/commands.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,29 @@ describe('commands', () => {
4545
analytics: true,
4646
});
4747
});
48+
49+
test('set', () => {
50+
connectorDataLayer({
51+
elb,
52+
mapping: {
53+
'set campaign': {
54+
name: 'walker globals',
55+
command: true,
56+
custom: {
57+
data: {
58+
term: 'term',
59+
},
60+
},
61+
},
62+
},
63+
});
64+
65+
gtag('set', 'campaign', {
66+
term: 'running+shoes',
67+
});
68+
69+
expect(elb).toHaveBeenNthCalledWith(1, 'walker globals', {
70+
term: 'running+shoes',
71+
});
72+
});
4873
});

packages/connectors/datalayer/src/mapping.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const defaultMapping: Mapping = {
2525
},
2626
},
2727
},
28-
// @TODO set for globals
2928
};
3029

3130
export function objToEvent(config: Config, obj: unknown): MappedEvent | void {

packages/connectors/datalayer/src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export type DataLayer = Array<unknown>;
1010
export interface Config {
1111
elb: WalkerOS.Elb;
1212
dataLayer: DataLayer;
13-
name?: string;
1413
mapping?: Mapping;
14+
name?: string;
1515
prefix: string;
1616
processedEvents: Set<string>;
1717
}

0 commit comments

Comments
 (0)