1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = { "snapshots": [
9 {
10 "name": "example-shop.com",
11 "snapshotDate": "2026-08-01T00:00:00+00:00",
12 "totalVisits": 120000,
13 "trafficSources": {
14 "directVisitsShare": 0.4,
15 "searchVisitsShare": 0.45,
16 "socialNetworksVisitsShare": 0.05,
17 "referralVisitsShare": 0.06,
18 "mailVisitsShare": 0.02,
19 "adsVisitsShare": 0.02,
20 },
21 "topCountries": [
22 {
23 "countryAlpha2Code": "US",
24 "visitsShare": 0.4,
25 },
26 {
27 "countryAlpha2Code": "GB",
28 "visitsShare": 0.1,
29 },
30 {
31 "countryAlpha2Code": "DE",
32 "visitsShare": 0.08,
33 },
34 ],
35 "topReferrals": [
36 {
37 "domain": "news-example.com",
38 "visitsShare": 0.2,
39 },
40 {
41 "domain": "deals-example.net",
42 "visitsShare": 0.1,
43 },
44 ],
45 "topKeywords": [
46 { "name": "example shop" },
47 { "name": "example shoes" },
48 ],
49 },
50 {
51 "name": "example-shop.com",
52 "snapshotDate": "2026-09-01T00:00:00+00:00",
53 "totalVisits": 96000,
54 "trafficSources": {
55 "directVisitsShare": 0.5,
56 "searchVisitsShare": 0.3,
57 "socialNetworksVisitsShare": 0.06,
58 "referralVisitsShare": 0.08,
59 "mailVisitsShare": 0.03,
60 "adsVisitsShare": 0.03,
61 },
62 "topCountries": [
63 {
64 "countryAlpha2Code": "US",
65 "visitsShare": 0.38,
66 },
67 {
68 "countryAlpha2Code": "GB",
69 "visitsShare": 0.12,
70 },
71 {
72 "countryAlpha2Code": "FR",
73 "visitsShare": 0.07,
74 },
75 ],
76 "topReferrals": [
77 {
78 "domain": "news-example.com",
79 "visitsShare": 0.25,
80 },
81 {
82 "domain": "coupons-example.org",
83 "visitsShare": 0.12,
84 },
85 ],
86 "topKeywords": [
87 { "name": "example shop" },
88 { "name": "example sale" },
89 ],
90 },
91 {
92 "name": "example-rival.com",
93 "snapshotDate": "2026-08-01T00:00:00+00:00",
94 "totalVisits": 200000,
95 "trafficSources": {
96 "directVisitsShare": 0.35,
97 "searchVisitsShare": 0.5,
98 "socialNetworksVisitsShare": 0.05,
99 "referralVisitsShare": 0.06,
100 "mailVisitsShare": 0.02,
101 "adsVisitsShare": 0.02,
102 },
103 "topCountries": [{
104 "countryAlpha2Code": "US",
105 "visitsShare": 0.5,
106 }],
107 "topReferrals": [],
108 "topKeywords": [],
109 },
110 {
111 "name": "example-rival.com",
112 "snapshotDate": "2026-09-01T00:00:00+00:00",
113 "totalVisits": 230000,
114 "trafficSources": {
115 "directVisitsShare": 0.33,
116 "searchVisitsShare": 0.55,
117 "socialNetworksVisitsShare": 0.04,
118 "referralVisitsShare": 0.05,
119 "mailVisitsShare": 0.02,
120 "adsVisitsShare": 0.01,
121 },
122 "topCountries": [{
123 "countryAlpha2Code": "US",
124 "visitsShare": 0.52,
125 }],
126 "topReferrals": [],
127 "topKeywords": [],
128 },
129 ] }
130
131
132run = client.actor("ntriqpro/similarweb-traffic-change-insights").call(run_input=run_input)
133
134
135print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
136for item in client.dataset(run.default_dataset_id).iterate_items():
137 print(item)
138
139