taboola-backstage-sdk 0.2.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -20
- package/dist/index.cjs +129 -648
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +549 -830
- package/dist/index.d.ts +549 -830
- package/dist/index.js +129 -648
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
[](https://nodejs.org/)
|
|
7
7
|
|
|
8
|
-
A comprehensive TypeScript SDK for the [Taboola Backstage API](https://developers.taboola.com/backstage-api/reference). Manage campaigns, ads, targeting, audiences, pixel tracking, and reporting programmatically.
|
|
8
|
+
A comprehensive TypeScript SDK for the [Taboola Backstage API](https://developers.taboola.com/backstage-api/reference). Manage campaigns, ads, targeting, audiences, pixel tracking, and reporting programmatically with full type safety.
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
@@ -108,10 +108,18 @@ const campaign = await client.campaigns.create('account-id', {
|
|
|
108
108
|
marketing_objective: 'DRIVE_WEBSITE_TRAFFIC',
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
// Update campaign
|
|
111
|
+
// Update campaign (partial updates - only specified fields are changed)
|
|
112
112
|
await client.campaigns.update('account-id', 'campaign-id', {
|
|
113
113
|
cpc: 0.75,
|
|
114
114
|
daily_cap: 500,
|
|
115
|
+
country_targeting: {
|
|
116
|
+
type: 'INCLUDE',
|
|
117
|
+
value: ['US', 'CA', 'GB'],
|
|
118
|
+
},
|
|
119
|
+
platform_targeting: {
|
|
120
|
+
type: 'INCLUDE',
|
|
121
|
+
value: ['DESK', 'PHON'],
|
|
122
|
+
},
|
|
115
123
|
});
|
|
116
124
|
|
|
117
125
|
// Pause / Unpause
|
|
@@ -148,18 +156,25 @@ const { results } = await client.items.list('account-id', 'campaign-id');
|
|
|
148
156
|
// Get single item
|
|
149
157
|
const item = await client.items.get('account-id', 'campaign-id', 'item-id');
|
|
150
158
|
|
|
151
|
-
// Create item
|
|
159
|
+
// Create item (static ad - only url accepted, starts in CRAWLING state)
|
|
152
160
|
const item = await client.items.create('account-id', 'campaign-id', {
|
|
153
161
|
url: 'https://example.com/landing',
|
|
154
|
-
title: 'Amazing Product - Learn More',
|
|
155
|
-
thumbnail_url: 'https://example.com/image.jpg',
|
|
156
|
-
description: 'Discover our latest offering',
|
|
157
|
-
cta: { cta_type: 'LEARN_MORE' },
|
|
158
162
|
});
|
|
163
|
+
// Poll until item.status changes from CRAWLING to RUNNING, then update fields
|
|
159
164
|
|
|
160
|
-
// Update item
|
|
165
|
+
// Update item (static or motion ad - partial updates supported)
|
|
161
166
|
await client.items.update('account-id', 'campaign-id', 'item-id', {
|
|
162
167
|
title: 'Updated Title',
|
|
168
|
+
url: 'https://example.com/new-landing-page',
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// Update motion ad with video
|
|
172
|
+
await client.items.update('account-id', 'campaign-id', 'motion-ad-id', {
|
|
173
|
+
title: 'Updated Motion Ad',
|
|
174
|
+
performance_video_data: {
|
|
175
|
+
video_url: 'https://example.com/video.mp4',
|
|
176
|
+
fallback_url: 'https://example.com/fallback.jpg',
|
|
177
|
+
},
|
|
163
178
|
});
|
|
164
179
|
|
|
165
180
|
// Pause / Unpause
|
|
@@ -169,7 +184,7 @@ await client.items.unpause('account-id', 'campaign-id', 'item-id');
|
|
|
169
184
|
// Delete
|
|
170
185
|
await client.items.delete('account-id', 'campaign-id', 'item-id');
|
|
171
186
|
|
|
172
|
-
// Bulk create
|
|
187
|
+
// Bulk create (supports both static and motion ads with full field set)
|
|
173
188
|
const { results } = await client.items.bulkCreate('account-id', 'campaign-id', {
|
|
174
189
|
items: [
|
|
175
190
|
{ url: 'https://example.com/1', title: 'Title 1', thumbnail_url: '...' },
|
|
@@ -233,20 +248,20 @@ const rules = await client.pixel.listConversionRules('account-id');
|
|
|
233
248
|
// Get single conversion rule
|
|
234
249
|
const rule = await client.pixel.getConversionRule('account-id', 'rule-id');
|
|
235
250
|
|
|
236
|
-
// Create conversion rule
|
|
251
|
+
// Create conversion rule (URL-based)
|
|
237
252
|
const rule = await client.pixel.createConversionRule('account-id', {
|
|
238
253
|
display_name: 'Purchase Completed',
|
|
239
|
-
type: '
|
|
240
|
-
category: '
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
value_parameter: 'order_total',
|
|
254
|
+
type: 'BASIC',
|
|
255
|
+
category: 'MAKE_PURCHASE',
|
|
256
|
+
condition: {
|
|
257
|
+
property: 'URL',
|
|
258
|
+
predicate: 'CONTAINS',
|
|
259
|
+
value: '/thank-you',
|
|
260
|
+
children: [],
|
|
247
261
|
},
|
|
248
|
-
|
|
249
|
-
|
|
262
|
+
effects: [{ type: 'REVENUE', data: '15' }],
|
|
263
|
+
look_back_window: 30,
|
|
264
|
+
view_through_look_back_window: 1,
|
|
250
265
|
});
|
|
251
266
|
|
|
252
267
|
// Archive / Unarchive
|
|
@@ -473,6 +488,7 @@ import type {
|
|
|
473
488
|
CreateCampaignRequest,
|
|
474
489
|
UpdateCampaignRequest,
|
|
475
490
|
CreateItemRequest,
|
|
491
|
+
BulkCreateItemData,
|
|
476
492
|
CreateSharedBudgetRequest,
|
|
477
493
|
|
|
478
494
|
// Report types
|