10.1.9 Automate your Media Buying Trafficking with our new Targeting Split function for Flows
Overview
ADvendio introduces a powerful new automation tool: the Split Targeting Apex Action, available for use in Salesforce Flows. This action allows you to programmatically break down complex targeting configurations stored in ADvendio's targeting JSON fields (like AdServerTargeting__c on Campaign Items or Buying Items) into multiple, simpler JSON strings based on a specific targeting category.
This is particularly useful for automating workflows where you need to create separate records (e.g., Buying Items, Campaign Items) based on individual targeting criteria within a single category from an originating record. For example, if a Campaign Item targets three different Audience Segments, you can use this action to generate three separate JSON strings, each containing only one of those Audience Segments, while preserving all other original targeting information (like Geography or Devices).
Key Features
Splits complex targeting JSON by a specified targeting category (e.g.,
AudienceSegments,Geography,KeyValue).Handles specific logic for
KeyValue(splits by group) andAudienceSegments(splits by individual value within groups).Retains all other non-split targeting categories in each resulting JSON string.
Optionally removes Campaign Builder version information from the JSON.
Designed as an Invocable Method for easy use within Salesforce Flows.
Using the 'Split Targeting' Action in a Flow
You can incorporate this action into your Record-Triggered Flows, Screen Flows, or Autolaunched Flows to automate targeting splits.
Add Apex Action: In your Flow, add an 'Action' element and search for "Split Targeting".
Configure Inputs: Set the following input parameters:
jsonString (Text, Required): Provide the targeting JSON string you want to split. Typically, this will be the value from a field like
AdServerTargeting__con your source record (e.g., Campaign Item).category (Text, Required): Specify the targeting category you want to split by. Examples for ADvendio supported Categories:
AudienceSegmentsGeographyKeyValueInventoryDevice
removeCampaignBuilderVersion (Boolean, Optional): Set to
trueif the input JSON comes from a Campaign Item created via Campaign Builder and you want to remove the version attribute, which might not be relevant for other processes. Defaults tofalseif left blank.
Handle Outputs: The action outputs a collection (List) of Text strings.
results (List<String>): Store this output in a Flow collection variable. Each string in this collection represents a split targeting JSON, containing one value/group from the specified category, plus all other original targeting data.
Process Results: You can ese a 'Loop' element in your Flow to iterate through the
resultscollection variable. And then add individual steps, for each time the targeting is split.Inside the Loop: You can use the current item (a single split JSON string) to:
Create new records (e.g., Buying Items, Campaign Items).
Update existing records.
Perform further logic based on the specific targeting criteria.
The result of this action is a valid Targeting String, that can be directly used in the dedicated Targeting Fields, in order to submit this information to connected platforms. The fields where you should store the string are:
Campaign Item: ADvendio__AdServerTargeting__c
Buying Item: ADvendio__SelectedTargeting__c
Example Use Case: Splitting by Audience Segments
Scenario: You have a Campaign Item targeting three different Audience Segments, plus specific Geography and Device criteria. You want to automatically create three separate Buying Items, each targeting only one of the Audience Segments but retaining the original Geography and Device targeting.
Flow Steps:
Please Note: This is just an example breakdown, you will need to make sure all required fields and related objected (e.g. Buying Orders) are set up in correct manner
Trigger: Start the Flow when a relevant Campaign Item is created or updated.
Get Record (Optional): If needed, get the triggering Campaign Item record data.
Call 'Split Targeting' Action:
jsonString:{![YourCampaignItem].AdServerTargeting__c}(Replace with your record variable)category:AudienceSegmentsStore
resultsin a new collection variable (e.g.,splitTargetingJsonList).
Loop: Iterate through the
splitTargetingJsonListcollection. Let the loop variable becurrentItem_SplitJson.Inside the Loop - Create Buying Item:
Add a 'Create Records' element for the Buying Item object.
Map fields:
Copy necessary fields (Name, Dates, Budget, etc.) from the original Campaign Item.
Set the Buying Item's
AdServerTargeting__cfield to the current loop item:{!currentItem_SplitJson}.Link it to the original Campaign Item or Media Campaign as needed.
End Loop.
This flow will automatically generate three Buying Items, each correctly targeted to one audience segment alongside the shared geo/device criteria.
Other Use Cases
Split by Geography: Create separate items for each targeted country, region, or city.
Split by Key-Values: If using Key-Values (often with GAM integrations), split based on defined Key-Value groups.
Split by Inventory: Separate items based on specific inventory types (e.g., Pinterest Creatives).
Best Practices
Validate Input: Ensure the
jsonStringinput is valid JSON before calling the action, if possible.Handle Multiple Results: Your flow logic (especially the loop) must correctly handle the list of results returned.
Choose Correct Category: Select the precise category name required for the split.
Performance: Be mindful of performance when dealing with extremely large or complex JSON structures, although the action is designed for efficiency.
Limitations
As of right now there are some limitations to the targeting split:
Split is only supported by Targeting Category, a dedicated split by types is not possible. E.g. Having Countries and Regions selected on an Item and then split only the Regions will not work. There will be an individual split for each selected Country and Region.
The Action only works on AdServerTargeting__c / SelectedTargeting__c some additional targeting types like Frequency Capping can not be split
Creative Targeting / Subtargeting is currently NOT supported by the split action.
Google DV360 uses the AdvancedSettings__c field for Floodlight Activity, APP and URL Targeting. This is currently NOT supported by the split action.