1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "currentItems": [
12 {
13 "id": "ad1",
14 "title": "Free trial - AI CRM",
15 "impressions": 420000,
16 "clicks": 16800,
17 "engagementRate": 4.2,
18 "activeDays": 8,
19 "adsCount": 6,
20 "offerStrength": 88,
21 "ctaStrength": 82
22 },
23 {
24 "id": "ad2",
25 "title": "Save 20% annual plan",
26 "impressions": 160000,
27 "clicks": 3900,
28 "engagementRate": 2.1,
29 "activeDays": 31,
30 "adsCount": 3,
31 "offerStrength": 66,
32 "ctaStrength": 58
33 }
34 ],
35 "previousItems": [
36 {
37 "id": "ad1",
38 "title": "AI CRM",
39 "impressions": 280000,
40 "clicks": 9200,
41 "engagementRate": 3.4,
42 "activeDays": 5,
43 "adsCount": 4,
44 "offerStrength": 72,
45 "ctaStrength": 70
46 }
47 ]
48};
49
50
51const run = await client.actor("quanmatrix/facebook-ads-creative-offer-intelligence").call(input);
52
53
54console.log('Results from dataset');
55console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
56const { items } = await client.dataset(run.defaultDatasetId).listItems();
57items.forEach((item) => {
58 console.dir(item);
59});
60
61