Files
DefinitelyTyped/types/ackee-tracker/ackee-tracker-tests.ts
ElectronicBlueberry 73dbb97533 🤖 Merge PR #57433 fix(ackee-tracker) pass param with unkown compile-time value to ackeeTracker.attributes() by @ElectronicBlueberry
* allow passing variables to ackeeTracker.attributes

* add test which fails before change

* add config to used files

* move config file to OTHER_FILES.txt
add OTHER_FILES.txt

* remove json from test
add TrackingOptions object to test

* remove resolve json module option

* removed consecutive blank lines

* add missing semicolon
2021-12-01 08:43:03 -08:00

47 lines
1.3 KiB
TypeScript

import * as ackeeTracker from 'ackee-tracker';
ackeeTracker.attributes();
ackeeTracker.attributes(true);
const instance1 = ackeeTracker.create('https://example.com');
const { stop } = instance1.record('hd11f820-68a1-11e6-8047-79c0c2d9bce0');
stop();
const stop2 = instance1.updateRecord('ID');
stop2.stop();
instance1.action('ID', { key: "key", value: 0 }, (id: string) => {});
instance1.action('ID', { key: "key" }, (id: string) => {});
instance1.action('ID', { key: "key", value: 0 });
instance1.action('ID', { key: "key" });
instance1.updateAction('ID', { key: "key", value: 0 });
instance1.updateAction('ID', { key: "key" });
ackeeTracker.detect();
const instance2 = ackeeTracker.create('https://example.com', {
ignoreLocalhost: true,
detailed: false,
ignoreOwnVisits: false
},
);
instance2.record('hd11f820-68a1-11e6-8047-79c0c2d9bce0', ackeeTracker.attributes(true));
const options: ackeeTracker.TrackingOptions = {
ignoreLocalhost: true,
detailed: true,
ignoreOwnVisits: true
};
const instance3 = ackeeTracker.create('https://example.com', {
ignoreLocalhost: options.ignoreLocalhost,
detailed: options.detailed,
ignoreOwnVisits: options.ignoreOwnVisits
},
);
instance3.record('https://example.com', ackeeTracker.attributes(options.detailed));