### Example GET Request URL Source: https://developers.taboola.com/backstage-api/reference/request-basics This is an example of a GET request URL for fetching campaign data. Ensure you replace placeholders like `[account_id]` and `[campaign_id]` with your actual values. ```http GET /backstage/api/1.0/ [account_id]/campaigns/[campaign_id]/ ``` -------------------------------- ### Example URL with Parameters Source: https://developers.taboola.com/pixel/docs/url-params-for-tracking This is an example of how URL parameters are structured, with key-value pairs separated by '&' and following a '?'. ```text http://yourlandingpage.com?utm_source=Taboola&utm_medium=referral ``` -------------------------------- ### API Request Example Source: https://developers.taboola.com/backstage-api/discuss/5e6f2b2104d2800011777ea5 A sample GET request for the campaign summary report. ```http GET https://backstage.taboola.com/backstage/api/1.0/{accountId}/reports/campaign-summary/dimensions/platform_breakdown?start_date=2020-02-01&end_date=2020-03-05&include_multi_conversions=true ``` -------------------------------- ### Example Landing Page URL with Parameters Source: https://developers.taboola.com/pixel/docs/s2s-conversion-tracking-with-ringba Example URL structure containing query parameters that Ringba captures as tags. ```text https://www.mylandingpage.com?taboola_id=xxx&page=6&ad_id=zzzz ``` -------------------------------- ### Install CocoaPods Source: https://developers.taboola.com/taboolasdk/docs/ios-sdk-3x-classic-first-steps Installs CocoaPods on your system. This command is required once per system. ```bash $ sudo gem install cocoapods ``` ```bash pod setup --verbose ``` -------------------------------- ### Campaign Object auto_publisher_targeting examples Source: https://developers.taboola.com/backstage-api/reference/campaign-auto-publisher-targeting Examples showing the default state with no exclusions and a state with specific publisher exclusions. ```json { "id": 1234, // ... "auto_publisher_targeting": { "type": "ALL", "value": [], "href": null } // ... } ``` ```json { "id": 1234, // ... "auto_publisher_targeting": { "type": "EXCLUDE", "value": [ "demo-publisher-1", "demo-publisher-2" ], "href": null } // ... } ``` -------------------------------- ### Campaign Object Connection Type Targeting Examples Source: https://developers.taboola.com/backstage-api/reference/campaign-connection-type-targeting Examples showing the default state of the connection_type_targeting field and how to configure it to include WIFI targeting. ```json { // other Campaign fields... "connection_type_targeting": { "type": "ALL", "value": [], "href": null }, "href": null } ``` ```json { // other Campaign fields... "connection_type_targeting": { "type": "INCLUDE", "value": [ "WIFI" ], "href": null } } ``` -------------------------------- ### Example Product IDs Source: https://developers.taboola.com/dynamic-creative/docs/server-to-server This snippet shows an example of product IDs used in Taboola's platform. ```json [ "productId2", "productId3", "productId4", "productId5" ] } ``` -------------------------------- ### Publisher Bid Modifier JSON Examples Source: https://developers.taboola.com/backstage-api/reference/publisher-bid-modifier-object Examples showing the default state with no modifiers and a populated state with specific publisher targets. ```json { // other Campaign fields... "publisher_bid_modifier": { "values": [] } } ``` ```json { // other Campaign fields... "publisher_bid_modifier": { "values": [ { "target": "demo-site-1", "cpc_modification": 1.5 }, { "target": "demo-site-2", "cpc_modification": 0.9 } ] } } ``` -------------------------------- ### Install Carthage Source: https://developers.taboola.com/taboolasdk/docs/ios-sdk-3x-classic-first-steps Installs Carthage on your system using Homebrew. This command is required once per system. ```bash $ brew update $ brew install carthage ``` -------------------------------- ### End-to-End Click ID Flow Examples Source: https://developers.taboola.com/pixel/docs/s2s-manual-integration Examples of the default Click ID parameter structure and the resulting URL format after the macro is replaced with an actual value. ```text ...&tblci={click_id} ``` ```text https://example.com/landing_page?...&tblci=a1b2c3d4e5f6 ``` -------------------------------- ### Invalid Request Examples Source: https://developers.taboola.com/backstage-api/reference/update-my-audience-targeting Examples of requests that will fail due to empty collections or missing required audience selections. ```json { "collection": [ { "collection": [], "type": "EXCLUDE" } ] } ``` ```json { "collection": [ { "collection": [], "type": "INCLUDE" }, { "collection": [], "type": "EXCLUDE" } ] } ``` ```json { "http_status": 400, "message": "Please select an audience", "offending_field": "retargeting_first_party_audience" } ``` -------------------------------- ### Build TBLWebUnit with TBLWebListener Source: https://developers.taboola.com/taboolasdk/docs/android-sdk-web-events Examples of initializing a TBLWebUnit with either a populated or empty TBLWebListener. ```java TBLWebUnit tblWebUnit = tblWebPage.build(, , , , new TBLWebListener(){ // Override any methods of interest. // An example for overriding 'onItemClick': @Override onItemClick(String placementName, String itemId, String clickUrl, boolean isOrganic, @Nullable String customData) { Log.d(TAG,"onItemClick"+itemId); return super.onItemClick(placementName, itemId, clickUrl, isOrganic, customData); } }); ``` ```java TBLWebUnit tblWebUnit = tblWebPage.build(, , , , new TBLWebListener() {}); ``` -------------------------------- ### Retrieve Campaign Audience Segments Source: https://developers.taboola.com/backstage-api/discuss/5ee8817bd87d81001139bb47 Example of a GET request to fetch audience segments for a specific campaign. ```http GET https://backstage.taboola.com/backstage/api/1.0/healthygem-m-sc/campaigns/5049950/targeting/audience_segments ``` -------------------------------- ### GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_campaign Source: https://developers.taboola.com/backstage-api/reference/realtime-campaign-summary-examples Retrieves real-time campaign summary data aggregated by campaign. Requires start and end dates. ```APIDOC ## GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_campaign ### Description Retrieves real-time campaign summary data aggregated by campaign. This endpoint is useful for understanding overall performance for each campaign within a specified date range. ### Method GET ### Endpoint /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_campaign ### Query Parameters - **start_date** (string) - Required - The start of the date range for the report (ISO 8601 format). - **end_date** (string) - Required - The end of the date range for the report (ISO 8601 format). ### Request Example ```http Request GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_campaign?start_date=2023-03-28T00:00:00&end_date=2023-03-28T23:59:59 HTTP/1.1 Host: backstage.taboola.com Authorization: Bearer {access-token} ``` ### Response #### Success Response (200) - **timezone** (string) - The timezone of the returned data. - **results** (array) - An array of objects, each representing a campaign with performance metrics. - **clicks** (integer) - The number of clicks. - **visible_impressions** (integer) - The number of visible impressions. - **spent** (number) - The amount spent. - **cpa_actions_num** (integer) - The number of CPA actions. - **conversions_value** (number) - The value of conversions. - **roas** (number) - Return on Ad Spend. - **vctr** (number) - Viewable Click-Through Rate. - **vcpm** (number) - Viewable Cost Per Mille (thousand impressions). - **cpc** (number) - Cost Per Click. - **cpa** (number) - Cost Per Action. - **cpa_conversion_rate** (number) - The conversion rate for CPA actions. - **campaign_id** (string) - The unique identifier for the campaign. - **campaign_name** (string) - The name of the campaign. - **recordCount** (integer) - The number of records returned. - **metadata** (object) - Metadata about the response. - **total** (integer) - Total number of records available. - **count** (integer) - Number of records in the current response. #### Response Example ```json { "timezone": "EDT", "results": [ { "clicks": 38, "visible_impressions": 1150, "spent": 1.14, "cpa_actions_num": 67, "conversions_value": 0, "roas": 0, "vctr": 3.3, "vcpm": 0.99, "cpc": 0.03, "cpa": 0.017, "cpa_conversion_rate": 176.3, "campaign_id": "483", "campaign_name": "My Test Campaign" } ], "recordCount": 2, "metadata": { "total": 2, "count": 2 } } ``` ``` -------------------------------- ### Define item with activity schedule Source: https://developers.taboola.com/backstage-api/reference/item-activity-schedule Example of an item object configured with a specific time zone for start and end dates. ```json { "id": "5678", "campaign_id": "1234", "url": "https://www.example.com/promo", "title": "February promo", "start_date": "2026-02-01 08:00:00", "end_date": "2026-02-28 23:45:00", "activity_schedule": { "time_zone": "America/New_York" } } ``` -------------------------------- ### Initialize Podfile Source: https://developers.taboola.com/taboolasdk/docs/ios-sdk-3x-classic-first-steps Initializes a Podfile for your iOS project. This command creates the Podfile if it doesn't exist. ```bash $ pod init ``` -------------------------------- ### GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_smallest_time_bucket Source: https://developers.taboola.com/backstage-api/reference/realtime-campaign-summary-examples Retrieves real-time campaign summary data aggregated by the smallest time bucket. Requires start and end dates. ```APIDOC ## GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_smallest_time_bucket ### Description Retrieves real-time campaign summary data aggregated by the smallest time bucket. This endpoint is useful for analyzing granular performance over short periods. ### Method GET ### Endpoint /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_smallest_time_bucket ### Query Parameters - **start_date** (string) - Required - The start of the date range for the report (ISO 8601 format). - **end_date** (string) - Required - The end of the date range for the report (ISO 8601 format). ### Request Example ```http Request GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_smallest_time_bucket?start_date=2023-03-28T00:00:00&end_date=2023-03-28T23:59:59 HTTP/1.1 Host: backstage.taboola.com Authorization: Bearer {access-token} ``` ### Response #### Success Response (200) - **timezone** (string) - The timezone of the returned data. - **results** (array) - An array of objects, each representing a time bucket with performance metrics. - **date** (string) - The timestamp for the data point. - **clicks** (integer) - The number of clicks. - **visible_impressions** (integer) - The number of visible impressions. - **spent** (number) - The amount spent. - **cpa_actions_num** (integer) - The number of CPA actions. - **conversions_value** (number) - The value of conversions. - **roas** (number) - Return on Ad Spend. - **vctr** (number) - Viewable Click-Through Rate. - **vcpm** (number) - Viewable Cost Per Mille (thousand impressions). - **cpc** (number) - Cost Per Click. - **cpa** (number) - Cost Per Action. - **cpa_conversion_rate** (number) - The conversion rate for CPA actions. - **recordCount** (integer) - The number of records returned. - **metadata** (object) - Metadata about the response, including field definitions. - **total** (integer) - Total number of records available. - **count** (integer) - Number of records in the current response. - **static_fields** (array) - Definitions of the fields returned in the results. #### Response Example ```json { "timezone": "EDT", "results": [ { "date": "2023-03-28 02:10:00.0", "clicks": 0, "visible_impressions": 2, "spent": 0, "cpa_actions_num": 0, "conversions_value": 0, "roas": 0, "vctr": 0, "vcpm": 0, "cpc": 0, "cpa": 0, "cpa_conversion_rate": 0 } ], "recordCount": 3, "metadata": { "total": 3, "count": 3, "static_fields": [ { "id": "date", "format": null, "data_type": "DATE" } ] } } ``` ``` -------------------------------- ### Initialize Taboola Units and Fetch Content Source: https://developers.taboola.com/taboolasdk/docs/react-native-plugin This example demonstrates how to initialize Taboola pages, listeners, and units for both widget and feed placements. It also shows how to fetch content for these units and includes cleanup logic to remove the Taboola page when the component unmounts. Ensure you use your own Taboola parameters as provided by Taboola. ```javascript import React, { useEffect, useState } from 'react'; import { View } from 'react-native'; import { Taboola, TBLClassicPage, TBLClassicListener, TBLClassicUnit, TBLPlacementType, useCreateUnit, } from '@taboola/react-native-plugin-4x'; const TaboolaFeedScreen = () => { // Create TBLClassicPage const [tblClassicPage] = useState(() => Taboola.getClassicPage( 'https://www.example.com/articles?id=123', 'article' ) ); // Set page to 'dark mode' (if configured) useEffect(() => { tblClassicPage.setPageExtraProperties({ darkMode: 'true' }); }, [tblClassicPage]); // Create TBLClassicListener const tblClassicListener: TBLClassicListener = { onResize(height: number): void { console.log('Unit resized:', height); }, onEvent(actionType: number, data: string): void { console.log('Event:', actionType, data); }, onAdReceiveFail(error: string): void { console.log('Ad receive failed:', error); }, onAdReceiveSuccess(): void { console.log('Ad received successfully'); }, onItemClick( placementName: string, itemId: string, clickUrl: string, isOrganic: boolean, customData?: string | null ): void { console.log('Item clicked:', { placementName, itemId, clickUrl, isOrganic, customData }); }, onTaboolaWidgetOnTop(): void { console.log('Widget on top'); }, onUpdateContentCompleted(): void { console.log('Content update completed'); }, }; // Create Unit - Widget const { tblClassicUnitController: widgetUnit } = useCreateUnit({ tblClassicPage, placement: 'Mid Article', mode: 'alternating-widget-with-video-1x1', placementType: TBLPlacementType.PAGE_MIDDLE, tblClassicListener: tblClassicListener, }); // Create Unit - Feed const { tblClassicUnitController: feedUnit } = useCreateUnit({ tblClassicPage, placement: 'Below Article Thumbnails Limited-20', mode: 'thumbs-feed-01', placementType: TBLPlacementType.FEED, tblClassicListener: tblClassicListener, }); // Fetch Content useEffect(() => { if (widgetUnit) { widgetUnit.fetchContent(); } }, [widgetUnit]); useEffect(() => { if (feedUnit) { feedUnit.fetchContent(); } }, [feedUnit]); // Cleanup useEffect(() => { return () => { if (tblClassicPage.pageId) { Taboola.removeClassicPage(tblClassicPage.pageId); } }; }, [tblClassicPage]); return ( {/* Widget */} {/* Feed */} ); }; export default TaboolaFeedScreen; ``` -------------------------------- ### Get Days of Week JSON Response Source: https://developers.taboola.com/backstage-api/reference/get-days-of-week Example response body containing the list of days of the week with their internal names and display values. ```json { "results": [ { "name": "MONDAY", "value": "Monday" }, { "name": "TUESDAY", "value": "Tuesday" }, { "name": "WEDNESDAY", "value": "Wednesday" }, { "name": "THURSDAY", "value": "Thursday" }, { "name": "FRIDAY", "value": "Friday" }, { "name": "SATURDAY", "value": "Saturday" }, { "name": "SUNDAY", "value": "Sunday" } ] // Additional detail omitted } ``` -------------------------------- ### GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_campaign_by_smallest_time_bucket Source: https://developers.taboola.com/backstage-api/reference/realtime-campaign-summary-examples Retrieves real-time campaign summary data aggregated by campaign and the smallest time bucket. Requires start and end dates, and optionally a campaign ID. ```APIDOC ## GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_campaign_by_smallest_time_bucket ### Description Retrieves real-time campaign summary data aggregated by campaign and the smallest time bucket. This endpoint allows for detailed analysis of specific campaigns over granular time intervals. ### Method GET ### Endpoint /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_campaign_by_smallest_time_bucket ### Query Parameters - **start_date** (string) - Required - The start of the date range for the report (ISO 8601 format). - **end_date** (string) - Required - The end of the date range for the report (ISO 8601 format). - **campaign** (string) - Optional - Filters the results for a specific campaign ID. ### Request Example ```http Request GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_campaign_by_smallest_time_bucket?start_date=2023-03-28T00:00:00&end_date=2023-03-28T01:00:00&campaign=483 HTTP/1.1 Host: backstage.taboola.com Authorization: Bearer {access-token} ``` ### Response #### Success Response (200) - **timezone** (string) - The timezone of the returned data. - **results** (array) - An array of objects, each representing a time bucket for a specific campaign with performance metrics. - **date** (string) - The timestamp for the data point. - **clicks** (integer) - The number of clicks. - **visible_impressions** (integer) - The number of visible impressions. - **spent** (number) - The amount spent. - **cpa_actions_num** (integer) - The number of CPA actions. - **conversions_value** (number) - The value of conversions. - **roas** (number) - Return on Ad Spend. - **vctr** (number) - Viewable Click-Through Rate. - **vcpm** (number) - Viewable Cost Per Mille (thousand impressions). - **cpc** (number) - Cost Per Click. - **cpa** (number) - Cost Per Action. - **cpa_conversion_rate** (number) - The conversion rate for CPA actions. - **campaign_id** (string) - The unique identifier for the campaign. - **campaign_name** (string) - The name of the campaign. - **recordCount** (integer) - The number of records returned. - **metadata** (object) - Metadata about the response. - **total** (integer) - Total number of records available. - **count** (integer) - Number of records in the current response. #### Response Example ```json { "timezone": "EDT", "results": [ { "date": "2023-03-28 00:55:00.0", "clicks": 2, "visible_impressions": 78, "spent": 0.06, "cpa_actions_num": 4, "conversions_value": 0, "roas": 0, "vctr": 2.56, "vcpm": 0.77, "cpc": 0.03, "cpa": 0.015, "cpa_conversion_rate": 200, "campaign_id": "483", "campaign_name": "My Test Campaign" } ], "recordCount": 2, "metadata": { "total": 2, "count": 2 } } ``` ``` -------------------------------- ### Create and Fetch Widget Unit (Objective-C) Source: https://developers.taboola.com/taboolasdk/docs/ios-sdk-3x-classic-basic-integration This Objective-C snippet demonstrates creating a widget unit and fetching its content. Ensure optional setters are applied if needed. ```Objective-C _widgetUnit = [classicPage createUnitWithPlacementName: mode:]; // (Apply optional setters here, if needed...) // Step 3 (this step): [_widgetUnit fetchContent]; ``` -------------------------------- ### Get Campaign Object (without external brand safety) Source: https://developers.taboola.com/backstage-api/reference/external-brand-safety This example shows the structure of a campaign object when no external brand safety is applied. It is useful for understanding the default state. ```http Request URL GET /backstage/api/1.0/demo-advertiser/campaigns/1234 ``` ```json Response Object { "id": 1234, // ... "external_brand_safety": { "type": "NONE", "values": [] } // ... } ``` -------------------------------- ### Fetch Real-time Summary by Campaign and Time Bucket Source: https://developers.taboola.com/backstage-api/reference/realtime-campaign-summary-examples Get a real-time summary broken down by both campaign and the smallest time bucket. This requires specifying start and end dates, and optionally a campaign ID. ```http GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_campaign_by_smallest_time_bucket?start_date=2023-03-28T00:00:00&end_date=2023-03-28T01:00:00&campaign=483 HTTP/1.1 Host: backstage.taboola.com Authorization: Bearer {access-token} ``` ```json { "timezone": "EDT", "results": [ { "date": "2023-03-28 00:55:00.0", "clicks": 2, "visible_impressions": 78, "spent": 0.06, "cpa_actions_num": 4, "conversions_value": 0, "roas": 0, "vctr": 2.56, "vcpm": 0.77, "cpc": 0.03, "cpa": 0.015, "cpa_conversion_rate": 200, "campaign_id": "483", "campaign_name": "My Test Campaign" }, { "date": "2023-03-28 00:50:00.0", "clicks": 3, "visible_impressions": 95, "spent": 0.09, "cpa_actions_num": 5, "conversions_value": 0, "roas": 0, "vctr": 3.16, "vcpm": 0.95, "cpc": 0.03, "cpa": 0.018, "cpa_conversion_rate": 166.7, "campaign_id": "483", "campaign_name": "My Test Campaign" } ], "recordCount": 2, "metadata": { "total": 2, "count": 2 } } ``` -------------------------------- ### Fetch Real-time Summary by Smallest Time Bucket Source: https://developers.taboola.com/backstage-api/reference/realtime-campaign-summary-examples Use this endpoint to get a real-time summary of campaign performance aggregated by the smallest time bucket. Requires specifying start and end dates. ```http GET /backstage/api/1.0/acme-advertising/reports/realtime-campaign-summary/dimensions/by_smallest_time_bucket?start_date=2023-03-28T00:00:00&end_date=2023-03-28T23:59:59 HTTP/1.1 Host: backstage.taboola.com Authorization: Bearer {access-token} ``` ```json { "timezone": "EDT", "results": [ { "date": "2023-03-28 02:10:00.0", "clicks": 0, "visible_impressions": 2, "spent": 0, "cpa_actions_num": 0, "conversions_value": 0, "roas": 0, "vctr": 0, "vcpm": 0, "cpc": 0, "cpa": 0, "cpa_conversion_rate": 0 }, { "date": "2023-03-28 02:05:00.0", "clicks": 0, "visible_impressions": 2, "spent": 0, "cpa_actions_num": 0, "conversions_value": 0, "roas": 0, "vctr": 0, "vcpm": 0, "cpc": 0, "cpa": 0, "cpa_conversion_rate": 0 }, { "date": "2023-03-28 02:00:00.0", "clicks": 0, "visible_impressions": 3, "spent": 0, "cpa_actions_num": 0, "conversions_value": 0, "roas": 0, "vctr": 0, "vcpm": 0, "cpc": 0, "cpa": 0, "cpa_conversion_rate": 0 } ], "recordCount": 3, "metadata": { "total": 3, "count": 3, "static_fields": [ { "id": "date", "format": null, "data_type": "DATE" }, { "id": "clicks", "format": null, "data_type": "NUMERIC" }, { "id": "visible_impressions", "format": null, "data_type": "NUMERIC" }, { "id": "spent", "format": null, "data_type": "MONEY" }, { "id": "cpa_actions_num", "format": null, "data_type": "NUMERIC" }, { "id": "conversions_value", "format": ".2f", "data_type": "MONEY" }, { "id": "roas", "format": ".2f", "data_type": "PERCENT" }, { "id": "vctr", "format": null, "data_type": "PERCENT" }, { "id": "vcpm", "format": null, "data_type": "MONEY" }, { "id": "cpc", "format": ".3f", "data_type": "MONEY" }, { "id": "cpa", "format": ".3f", "data_type": "MONEY" }, { "id": "cpa_conversion_rate", "format": null, "data_type": "PERCENT" } ] } } ``` -------------------------------- ### Fetch Hourly Campaign Data Source: https://developers.taboola.com/backstage-api/changelog/campaign-hour-breakdown-dimension Use this GET request to retrieve the most recent 24 hours of campaign data broken down by hour. Ensure the start and end dates are within the recommended 48-hour interval. ```http GET /backstage/api/1.0/demo-account/reports/campaign-summary/dimensions/campaign_hour_breakdown?start_date=2021-10-01T13:00:00&end_date=2021-10-02T12:59:59 ``` -------------------------------- ### Complete Taboola integration example Source: https://developers.taboola.com/taboolasdk/docs/ios-sdk-web-basic-integration-with-swiftui A full implementation combining the wrapper, delegate methods, and the SwiftUI view component. ```swift import SwiftUI import TaboolaSDK import TaboolaSDK_SwiftUI_Umbrella class WebPageWrapper: NSObject, WebPageWrappable { var page: TBLWebPage! override init() { super.init() page = TBLWebPage(delegate: self) page.pageExtraProperties = ["testWebKey":"testWebValue"] } } extension WebPageWrapper: TBLWebPageDelegate { func webView(_ webView: WKWebView!, didClickPlacementName placementName: String!, itemId: String!, clickUrl: String!, isOrganic organic: Bool) -> Bool { // Insert your code here... // Return 'false' if you are handling the click event yourself, or 'true' if you want Taboola SDK to handle the click event. // Note: you can override the default behavior for *organic* content only. return true } func webView(_ webView: WKWebView!, didLoadPlacementName placementName: String!, height: CGFloat) { print("Loaded placement: \(placementName ?? "unknown")") } func webView(_ webView: WKWebView!, didFailToLoadPlacementName placementName: String!, errorMessage error: String!) { print("Failed to load placement: \(placementName ?? "unknown") - \(error ?? "unknown error")") } } struct TaboolaWebView: View { private let pageWrapper = WebPageWrapper() var body: some View { VStack { if let baseURL = URL(string: "https://cdn.taboola.com/mobile-sdk/init/") { WebUnitSwiftUI(pageWrapper: pageWrapper, source: "SampleHTMLPage", baseURL: baseURL) } else { Text("No content to display. Please check your URL!") } } } } ``` -------------------------------- ### Create Campaign with MAXIMIZE_CONVERSIONS Strategy Source: https://developers.taboola.com/backstage-api/reference/create-a-campaign Example request and response for a campaign using the MAX_CONVERSIONS bidding strategy. ```http POST /backstage/api/1.0/acme-advertising/campaigns/ HTTP/1.1 Host: backstage.taboola.com Content-Type: application/json Authorization: Bearer {access_token} ``` ```json { "name": "Max Conversions Campaign", "branding_text": "branding", "spending_limit": 100, "spending_limit_model": "MONTHLY", "bid_strategy": "MAX_CONVERSIONS", "marketing_objective": "LEADS_GENERATION" } ``` ```json { "id": 1234, "advertiser_id": "acme-advertising", "name": "Max Conversions Campaign", "branding_text": "branding", "cpc": null, "spending_limit": 100.0, "spending_limit_model": "MONTHLY", "bid_strategy": "MAX_CONVERSIONS", "marketing_objective": "LEADS_GENERATION", ... } ``` -------------------------------- ### Campaign Summary Report with 'day' Dimension Source: https://developers.taboola.com/backstage-api/reference/dimensions-and-columns Use the 'day' dimension to aggregate campaign data per day. This example shows a GET request to the Campaign Summary Report endpoint with the specified dimension and date filters. ```http GET /backstage/api/1.0/taboola-demo-advertiser/reports/campaign-summary/dimensions/day?start_date=2015-03-30&end_date=2015-03-30 ``` -------------------------------- ### Get Site-Level Summary Report URL with Campaign Filter Source: https://developers.taboola.com/backstage-api/discuss/610fd9013f8da2002351dd0b This URL is used to fetch site-level statistics for a specific campaign. It requires specifying start and end dates, and a campaign ID filter. The site-level bid is calculated as CPC multiplied by the CPC modification. ```string {{url}}/backstage/api/1.0/{{account}}/reports/campaign-summary/dimensions/site_breakdown?start_date=2021-07-01&end_date=2021-07-21&campaign=123456 ``` -------------------------------- ### OpenAPI Definition for Get Taxonomies Source: https://developers.taboola.com/backstage-api/reference/get-taxonomies This OpenAPI 3.1.0 definition describes the Get Taxonomies endpoint. It specifies the GET method, required 'url' query parameter, and the base server URL. ```json { "openapi": "3.1.0", "info": { "title": "backstage_api_json", "version": "1.0" }, "servers": [ { "url": "https://backstage.taboola.com" } ], "security": [ {} ], "paths": { "/backstage/api/1.0/operations/thirdparty/taxonomies": { "get": { "summary": "Get Taxonomies", "description": "Fetch taxonomies for a given URL.", "operationId": "get-taxonomies", "parameters": [ { "name": "url", "in": "query", "description": "The web page to analyze.", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "x-readme": { "headers": [], "explorer-enabled": false, "proxy-enabled": false }, "x-readme-fauxas": true } ``` -------------------------------- ### Initialize Explore More - Java Source: https://developers.taboola.com/taboolasdk/docs/android-sdk-classic-explore-more Initializes the Explore More unit and starts loading content in the background. Returns a TBLExploreMoreCTAButton that can be added to your layout. ```java TBLExploreMoreCTAButton ctaButton = page.initExploreMore( context, tblExploreMoreListener, placementName, mode, customSegment, fragmentManager); ``` -------------------------------- ### Configure Campaign Duplication Settings Source: https://developers.taboola.com/backstage-api/reference/duplicate-a-campaign Examples showing how to define the duplicate_settings object to control which campaign components are included in the duplication. ```julia { ... "duplicate_settings": { "include_items": false, "include_publisher_bid_modifiers": false, "include_blocked_publishers": true, "include_third_party_tracking": true } } ``` ```json { ... "duplicate_settings": { "include_items": false, "include_publisher_bid_modifiers": false } } ``` -------------------------------- ### Push Placement Configuration Source: https://developers.taboola.com/web-integrations/docs/infinite-scroll Initialize the global command queue and push placement-specific parameters provided by Taboola. ```javascript // *Global* command queue for the page window._taboola = window._taboola || []; // For each placement, pass *your* param values, as provided by Taboola: _taboola.push({mode: '', container: '', placement: '', target_type: ''}); ``` -------------------------------- ### Install iOS Dependencies Source: https://developers.taboola.com/taboolasdk/docs/react-native-plugin Run this command within the ios directory to install the Taboola SDK via CocoaPods. ```shell pod install ``` -------------------------------- ### Initialize Taboola SDK Source: https://developers.taboola.com/taboolasdk/docs/flutter-plugin Import the SDK, create the publisher info object, and initialize the Taboola instance in your main.dart file. ```java import 'package:taboola_sdk/taboola.dart'; ``` ```java TBLPublisherInfo tblPublisherInfo = TBLPublisherInfo(); ``` ```java Taboola.setLogsEnabled(true); // (Optional) Enable logging (Disable this before you go live.) Taboola.init(tblPublisherInfo); ``` -------------------------------- ### Install Taboola React Native Plugin Source: https://developers.taboola.com/taboolasdk/docs/react-native-plugin Run this command in the root of your project to install the Taboola plugin dependency. ```shell npm i @taboola/react-native-plugin-4x ``` -------------------------------- ### Create Unit Controller Source: https://developers.taboola.com/taboolasdk/docs/react-native-migration Use the useCreateUnit hook to initialize the controller for the classic unit. ```javascript const { tblClassicUnitController: classicUnit } = useCreateUnit({ tblClassicPage, placement: 'PLACEMENT_NAME', mode: 'PLACEMENT_MODE', placementType: TBLPlacementType, tblClassicListener: TblClassicListener, }); ``` -------------------------------- ### Create TBLWebUnit Instance (Objective-C) Source: https://developers.taboola.com/taboolasdk/docs/ios-sdk-3x-web-basic-integration Create a single TBLWebUnit instance for the initialized TBLWebPage. This is done in the viewDidLoad method after initializing the TBLWebPage. ```Objective-C #import @property (nonatomic, strong) TBLWebPage *webPage; @property (nonatomic, strong) TBLWebUnit *webUnit; - (void)viewDidLoad { // Step 1: _webPage = [[TBLWebPage alloc]initWithDelegate:self]; // Step 2 (this step): _webUnit = [webPage createUnitWithWebView:< webview>]; // (Apply optional setters here, if needed...) } ``` -------------------------------- ### Configure Carthage Copy Frameworks Script Source: https://developers.taboola.com/taboolasdk/docs/ios-sdk-3x-classic-first-steps Add the appropriate Carthage copy-frameworks command to your Run Script Phase based on your machine architecture. ```bash $ /usr/local/bin/carthage copy-frameworks ``` ```bash $ /opt/homebrew/bin/carthage ``` -------------------------------- ### Install Taboola SDK with CocoaPods Source: https://developers.taboola.com/taboolasdk/docs/ios-sdk-3x-classic-first-steps Installs the Taboola SDK into your iOS project using CocoaPods. After running this, open the .xcworkspace file. ```bash $ pod install ``` -------------------------------- ### Create TBLWebUnit Instance (Swift) Source: https://developers.taboola.com/taboolasdk/docs/ios-sdk-3x-web-basic-integration Create a single TBLWebUnit instance for the initialized TBLWebPage. This is done in the viewDidLoad method after initializing the TBLWebPage. ```Swift import TaboolaSDK var webPage: TBLWebPage? // Page var webUnit: TBLWebUnit? override func viewDidLoad() { // Step 1: webPage = TBLWebPage.init(delegate: self) // Step 2 (this step): webUnit = webPage?.createUnit(with: webView) // (Apply optional setters here, if needed...) } ``` -------------------------------- ### Setup WebView for Taboola Source: https://developers.taboola.com/taboolasdk/docs/android-sdk-web-basic-integration-with-compose A comprehensive method to enable JavaScript and build the Taboola unit with a custom listener. ```kotlin /** * Build a Taboola Page and Unit to describe the screen and placement you wish Taboola to work with. * Notice: Taboola requires JavaScript to be enabled in the WebView to work. */ @SuppressLint("SetJavaScriptEnabled") fun setupWebViewForTaboola(webView: WebView): TBLWebUnit { // If not already set in your WebView webView.settings.javaScriptEnabled = true return Taboola.getWebPage().build(webView, object : TBLWebListener() { override fun onItemClick( placementName: String?, itemId: String?, clickUrl: String?, isOrganic: Boolean, customData: String? ): Boolean { println("Taboola | onItemClick | isOrganic = $isOrganic") return super.onItemClick(placementName, itemId, clickUrl, isOrganic, customData) } }) } ``` -------------------------------- ### S2S conversion tracking example Source: https://developers.taboola.com/pixel/docs/s2s-track-crm-conversions A concrete example of an HTTP request sent to Taboola with a specific Click ID and event name. ```http https://trc.taboola.com/actions-handler/log/3/s2s-action?click-id=GiC3sJdfEHXrroWoRIMZNc-HmQGs4UllzePkXl8h7XSOfSDOqFUoqNjkqZDk_6u1ATCn214&name=appointment_scheduled ``` -------------------------------- ### Bad Request Response Example Source: https://developers.taboola.com/backstage-api/reference/update-lookalike-audience-targeting Example of a 400 Bad Request response when attempting an unsupported operation, such as excluding lookalike audiences. ```json { "http_status": 400, "message": "Invalid input - Exclude for lookalike audiences is not supported.", "offending_field": "lookalike_audience_targeting.collection[0].type" } ``` -------------------------------- ### POST /backstage/api/1.0/{account_id}/audience_onboarding/create Source: https://developers.taboola.com/backstage-api/reference/create-a-first-party-audience Creates a new first-party audience for a specified account. Requires an alphabetic account ID. ```APIDOC ## POST /backstage/api/1.0/{account_id}/audience_onboarding/create ### Description Creates a new first-party audience. Refer to the onboarding overview for supported countries. ### Method POST ### Endpoint /backstage/api/1.0/{account_id}/audience_onboarding/create ### Parameters #### Path Parameters - **account_id** (string) - Required - An alphabetic ID for the account. #### Request Body - **audience_name** (string) - Required - The name of the audience. - **ttl_in_hours** (integer) - Required - Time to live for the audience in hours. - **integration_source** (string) - Required - The source of the integration (e.g., Tealium). ### Request Example { "audience_name": "Demo Audience Name", "ttl_in_hours": 1440, "integration_source": "Tealium" } ### Response #### Success Response (200) - **audience_name** (string) - The name of the created audience. - **ttl_in_hours** (integer) - The TTL value in hours. - **audience_id** (integer) - The unique ID of the created audience. - **exclude_from_campaigns** (boolean) - Indicates if the audience is excluded from campaigns. - **integration_source** (string) - The integration source used. #### Response Example { "audience_name": "Demo Audience Name", "ttl_in_hours": 1440, "audience_id": 49, "exclude_from_campaigns": false, "integration_source": "Tealium" } ``` -------------------------------- ### Sample access token request Source: https://developers.taboola.com/newsroom/docs/taboola-newsroom-api Example request using specific credentials to obtain an access token. ```shell curl 'https://authentication.taboola.com/authentication/oauth/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'client_id=3acdf166e55fc583345e731510c29011' \ --data-urlencode 'client_secret=22a886f1a6014a658ae953e61ec535db' \ --data-urlencode 'grant_type=client_credentials' ``` ```http POST /authentication/oauth/token Content-Type: application/x-www-form-urlencoded Host: authentication.taboola.com client_id=3acdf166e55fc583345e731510c29011&client_secret=22a886f1a6014a658ae953e61ec535db&grant_type=client_credentials ``` -------------------------------- ### 404 Error Response Example Source: https://developers.taboola.com/backstage-api/reference/error An example of a 404 Not Found error response from the Taboola API. This indicates that the requested resource could not be found. ```json { "http_status": 404, "message": "Resource not found" } ``` -------------------------------- ### Initialize Taboola SDK Source: https://developers.taboola.com/taboolasdk/docs/react-native-migration Initialize the SDK in your index.js file using your publisher name and set the desired log level. ```javascript import './gesture-handler'; import { AppRegistry } from 'react-native'; import App from './src/App'; import { name as appName } from './app.json'; import { Taboola, TBLLogLevel } from '@taboola/react-native-plugin-4x'; import { PublisherName } from './src/utils/constants'; Taboola.init(PublisherName.SDK_TESTER_RNI); Taboola.setLogLevel(TBLLogLevel.DEBUG); AppRegistry.registerComponent(appName, getComponentFunc: () => App); ``` -------------------------------- ### Get Lookalike Audiences Request Source: https://developers.taboola.com/backstage-api/reference/get-lookalike-audiences-for-specified-country Use this HTTP GET request to retrieve a list of available Lookalike Audiences for a specific account and country. ```http GET /backstage/api/1.0/demo-account/dictionary/lookalike_audiences/US ```