1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "journeys": [
12 {
13 "name": "Lead form (accept all)",
14 "startUrl": "https://www.example.com/contact",
15 "consent": "accept",
16 "steps": [
17 {
18 "action": "fill",
19 "selector": "input[name=email]",
20 "value": "{{email}}"
21 },
22 {
23 "action": "fill",
24 "selector": "input[name=name]",
25 "value": "{{name}}"
26 },
27 {
28 "action": "click",
29 "selector": "button[type=submit]"
30 },
31 {
32 "action": "waitForUrl",
33 "url": "/thank"
34 }
35 ],
36 "expectedEvents": [
37 {
38 "platform": "ga4",
39 "event": "generate_lead",
40 "afterStep": 3
41 },
42 {
43 "platform": "meta",
44 "event": "Lead",
45 "afterStep": 3,
46 "params": {
47 "eid": "*"
48 }
49 },
50 {
51 "platform": "google-ads",
52 "conversionLabel": "YOUR_LABEL"
53 }
54 ]
55 },
56 {
57 "name": "Home page (reject all)",
58 "startUrl": "https://www.example.com/",
59 "consent": "reject",
60 "steps": [
61 {
62 "action": "scroll"
63 }
64 ],
65 "expectedEvents": []
66 }
67 ]
68};
69
70
71const run = await client.actor("siteverdict/siteverdict-tracking-qa-robot").call(input);
72
73
74console.log('Results from dataset');
75console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
76const { items } = await client.dataset(run.defaultDatasetId).listItems();
77items.forEach((item) => {
78 console.dir(item);
79});
80
81