This API request stores and updates ad cost data for a specific site using the HTTP method PUT. The request includes the following parameters:
SiteId
stringRequiredThe ID of the site for which to add or update ad cost data
Authorization
stringRequiredThe authorization token for accessing the API. The header value should be set to "Bearer {your-access-token}", where {your-access-token}
is the access token assigned to the user.
The data containing the ad cost information to store or update. The payload should include the following parameters:
CaptureDateIso
stringRequiredThe ISO 8601 date when the ad cost was captured (format: yyyy-MM-dd). Should not be a future date.
Cost
doubleRequiredThe cost of the ad.
CurrencyCode
stringRequiredThe currency code for the ad. Must be valid and non-empty. Examples include GBP, USD, EUR
Impressions
intThe number of times the ad was displayed.
Clicks
intThe number of clicks generated by the ad.
MarketingSource
stringRequiredThe source of the marketing platform. Only custom sources are accepted. If you wish to use one of our supported cost ingestions then please contact customer support.
AdCostType
stringRequiredThe type of ad cost. Must be one of the following values:
AdCostType | Description |
---|---|
Affiliate | Affiliate marketing costs such as Awin, or ShareASale |
PayPerClick | Pay-per-click advertising costs such as Google Ads, Bing Ads |
SocialMedia | Social media advertising costs on platforms such as Facebook, Instagram, and LinkedIn |
ContentDiscovery | Content discovery platform costs such as Taboola, Outbrain |
Programmatic | Programmatic ad buying costs such as The Trade Desk |
DemandSidePlatform | Costs from demand-side platforms (DSP) such as Amazon DSP, Google DV360 |
RetargetingAndPersonalizedAdvertisingPlatform | Retargeting or personalized ad platform costs such as Criteo and AdRoll |
CampaignIdentifiers
ArrayRequiredCampaign Identifiers provide a way to attribute ad costs to specific campaign levels. These identifiers allow for detailed cost tracking, enabling you to view ad spend at a highly granular level for each day.
An array of campaign identifiers. Each item in the array should include the following parameters:
IdentifierName
stringRequiredThe name for the campaign identifier.
IdentifierValue
stringRequiredThe value for the campaign identifier.
Importance
intRequiredHierarchical importance (1 = most important/granular e.g. A Keyword).
You must provide at least one campaign idenfitier and it should help make the ad cost unique for the given date supplied.
There are many benefits to supplying more granular levels of identifiers:
The following example data shows various levels of campaign identifiers and their usage:
Identifier Name | Identifier Value | Importance |
---|---|---|
CampaignLevelId | 123 | 10 |
CampaignLevelValue | example campaign name | 9 |
AdLevel1Id | 456 | 8 |
AdLevel1Value | example ad group name | 7 |
AdLevel2Id | 789 | 6 |
AdLevel2Value | example ad name | 5 |
AdLevel3Id | 098 | 4 |
AdLevel3Value | example creative name | 3 |
KeywordId | 765 | 2 |
KeywordValue | example keyword example | 1 |
AdditionalProperties
ArrayAn array of additional properties. Each item should include the following parameters:
Name
stringRequiredThe name of the additional property.
Value
stringRequiredThe value of the additional property.
Replace {siteId}
in the URL endpoint with the appropriate ID for the site, and replace {your-access-token}
in the authorization header with your access token.
curl -X PUT \ 'https://rest.rulerapi.com/v1/{siteId}/adcost/upload' \ -H 'Authorization: Bearer {your-access-token}' \ -H 'Content-Type: application/json' \ -d '{ "CaptureDateIso": "{captureDateIso}", "Cost": "{cost}", "CurrencyCode": "{currencyCode}", "Impressions": "{impressions}", "Clicks": "{clicks}", "MarketingSource": "{marketingSource}", "AdCostType": "{adCostType}", "CampaignIdentifiers": [ { "IdentifierName": "{identifierName}", "IdentifierValue": "{identifierValue}", "Importance": "{importance}" } ], "AdditionalProperties": [ { "Name": "{name}", "Value": "{value}" } ] }'