1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = { "events": [
9 {
10 "name": "purchase",
11 "params": {
12 "transaction_id": "SYNTHETIC-001",
13 "currency": "EUR",
14 "value": 25,
15 "tax": 5,
16 "shipping": 2,
17 "items": [
18 {
19 "item_id": "SKU-01",
20 "price": 10,
21 "quantity": 2,
22 },
23 {
24 "item_name": "Blue mug",
25 "price": 5,
26 },
27 ],
28 },
29 },
30 {
31 "name": "purchase",
32 "params": {
33 "transaction_id": "SYNTHETIC-002",
34 "currency": "EUR",
35 "value": 32,
36 "tax": 5,
37 "shipping": 2,
38 "items": [
39 {
40 "item_id": "SKU-01",
41 "price": 10,
42 "quantity": 2,
43 },
44 {
45 "item_name": "Blue mug",
46 "price": 5,
47 },
48 ],
49 },
50 },
51 {
52 "name": "add_to_cart",
53 "params": {
54 "value": 1,
55 "items": [{
56 "item_id": "SKU-01",
57 "price": 1,
58 "quantity": 1,
59 }],
60 },
61 },
62 {
63 "name": "refund",
64 "params": {
65 "transaction_id": "OUTSIDE-THIS-SYNTHETIC-SAMPLE",
66 "value": 5,
67 "currency": "EUR",
68 },
69 },
70 ] }
71
72
73run = client.actor("danielmichalek/ga4-ecommerce-event-auditor").call(run_input=run_input)
74
75
76print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
77for item in client.dataset(run.default_dataset_id).iterate_items():
78 print(item)
79
80