1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "snapshotId": "synthetic-integration-change-01",
12 "batchCoverage": "sampled",
13 "events": [
14 {
15 "rowId": "r01",
16 "datasetId": "pixel-01",
17 "eventName": "Purchase",
18 "eventId": "0001",
19 "source": "browser",
20 "actionId": "A"
21 },
22 {
23 "rowId": "r02",
24 "datasetId": "pixel-01",
25 "eventName": "Purchase",
26 "eventId": "0001",
27 "source": "server",
28 "actionId": "A"
29 },
30 {
31 "rowId": "r03",
32 "datasetId": "pixel-01",
33 "eventName": "Purchase",
34 "eventId": "0002",
35 "source": "browser",
36 "actionId": "B"
37 },
38 {
39 "rowId": "r04",
40 "datasetId": "pixel-01",
41 "eventName": "Purchase",
42 "eventId": null,
43 "source": "server",
44 "actionId": "C"
45 },
46 {
47 "rowId": "r05",
48 "datasetId": "pixel-01",
49 "eventName": "Purchase",
50 "eventId": "0004",
51 "source": "server",
52 "actionId": "D"
53 },
54 {
55 "rowId": "r06",
56 "datasetId": "pixel-01",
57 "eventName": "Purchase",
58 "eventId": "0004",
59 "source": "server",
60 "actionId": "D"
61 },
62 {
63 "rowId": "r07",
64 "datasetId": "pixel-01",
65 "eventName": "Purchase",
66 "eventId": "0005",
67 "source": "browser",
68 "actionId": "E"
69 },
70 {
71 "rowId": "r08",
72 "datasetId": "pixel-01",
73 "eventName": "Purchase",
74 "eventId": "0005",
75 "source": "server",
76 "actionId": "F"
77 },
78 {
79 "rowId": "r09",
80 "datasetId": "pixel-01",
81 "eventName": "Purchase",
82 "eventId": "0006",
83 "source": "browser",
84 "actionId": "G"
85 },
86 {
87 "rowId": "r10",
88 "datasetId": "pixel-01",
89 "eventName": "Purchase",
90 "eventId": "0007",
91 "source": "server",
92 "actionId": "G"
93 },
94 {
95 "rowId": "r11",
96 "datasetId": "pixel-02",
97 "eventName": "Purchase",
98 "eventId": "0001",
99 "source": "server",
100 "actionId": "A"
101 },
102 {
103 "rowId": "r12",
104 "datasetId": "pixel-01",
105 "eventName": "ViewContent",
106 "eventId": "0001",
107 "source": "browser",
108 "actionId": "H"
109 },
110 {
111 "rowId": "r13",
112 "datasetId": "pixel-01",
113 "eventName": "Purchase",
114 "eventId": "0008",
115 "source": "browser",
116 "actionId": null
117 },
118 {
119 "rowId": "r14",
120 "datasetId": "pixel-01",
121 "eventName": "Purchase",
122 "eventId": "0008",
123 "source": "server",
124 "actionId": null
125 },
126 {
127 "rowId": "r15",
128 "datasetId": "pixel-01",
129 "eventName": "Purchase",
130 "eventId": "0009",
131 "source": "browser",
132 "actionId": "I"
133 },
134 {
135 "rowId": "r16",
136 "datasetId": "pixel-01",
137 "eventName": "PageView",
138 "eventId": "0009",
139 "source": "server",
140 "actionId": "I"
141 }
142 ],
143 "eventsCsv": "",
144 "eventColumns": {
145 "rowId": "rowId",
146 "datasetId": "datasetId",
147 "eventName": "eventName",
148 "eventId": "eventId",
149 "source": "source",
150 "actionId": "actionId"
151 }
152};
153
154
155const run = await client.actor("h_murdock/browser-server-event-identity").call(input);
156
157
158console.log('Results from dataset');
159console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
160const { items } = await client.dataset(run.defaultDatasetId).listItems();
161items.forEach((item) => {
162 console.dir(item);
163});
164
165