Salesforce

Reporting API – Advanced options

« Go Back
Information
Reporting API – Advanced options
Reporting-API-Advanced-options
Details

Related resources

Available dimensions and metrics

Learn more about the available dimensions and metrics in these articles:

Field options for metrics and dimensions

When requesting metrics and dimensions, you can use the following advanced field options:

  • OutputName: modifies the name of a field (dimension/metric) in the final report
  • Parameters: allows for the definition of additional parameters for specific types of fields

Modifying the output name of a field (dimension/metric)

You can specify an output name for any field (dimension/metric); in the final retrieved report, the field will have the specified output name, instead of the field’s default name.

The special characters , ) ( & ; - are prohibited in the outputName field. Using such characters will result in an error.


The sample below: 

  • changes the dimension Day to Day new name
  • changes the metric Impressions to Ad Impressions

 

{  
"reportName": "doc_sample_4_output_names",
    "startDate": "2023-11-09T00:00:00",
    "endDate": "2023-11-10T00:00:00",
      "dimensions":[
        {
            "field": "Day",
            "outputName": "Day new name"
        }
       ],
       "metrics":[
         {
            "field": "Impressions",
            "outputName": "Ad Impressions"
        },
        {
            "field": "Clicks"
        }

       ],
       "useCaseId": "RTB",
       "onFinishEmails": ["example@example.com"]
}

 


Specifying field parameters

For some metrics, you can/must specify additional parameters.

Parameters for the EventCount metric
The EventCount metric counts the number of times an event occurred. This metric requires the additional parameter EventId to be specified.

The sample below requests the number of times the event with ID 18 (= mute) occurred:

{  
"reportName": "doc_sample_5_event_count",
    "startDate": "2023-11-09T00:00:00",
    "endDate": "2023-11-10T00:00:00",
      "dimensions":[
        {
            "field": "Day"
        }
       ],
       "metrics":[
         {
            "field": "Impressions",
            "outputName": "Ad Impressions"
        },
        {
            "field": "Clicks"
        },
        {
            "field": "EventCount",
            "parameters": {
                "EventId": "18"
            },
            "OutputName": "Number of Mute events"
        }
       ],
       "useCaseId": "RTB",
       "onFinishEmails": ["example@example.com"]
}

EventIds

The table below contains the EventIds you can use as parameters of the EventCount metric.

Event IdEvent Name
1timeview
2start
3stop
4restart
5expand
6collapse
7audioon
8audiooff
9clickposition
10truecount
11serverside
12visibility
13creativeview
14firstquartile
15midpoint
16thirdquartile
17complete
18mute
19unmute
20pause
21rewind
22resume
23fullscreen
24exitfullscreen
25acceptinvitationlinear
26closelinear
27skip
28progress
29v_firstsecond
30v_firstquartile
31v_midpoint
32v_thirdquartile
33v_complete
34timetoclick
35ad
36noad
37timeout
38bid
39winnotice
40wrapper
43adexpand
44adskip
45adcollapse
46adslidecount
48close
49vnoad
50download
58otherAdInteraction
59minimize
60overlayViewDuration
10007inventory
10008click
10009videoerror
10010loaded
10012mraidImpression
10013omidImpression
10014hbRenderSuccess
10015hbRenderFailed
10016classicImpression
10017vmapimpression
10018like
10019reblog
10020share
10021comment
10022userengagement
10023vmapstart
10024ServerSideHeaderBiddingWin
10025bumper
10026ServerSideHeaderBiddingLoss
10027impressionsonepx
10028impressionsthirtysec
10029impressionsonrender

Date format

Absolute dates must be formatted in the format: yyyy-MM-dd'T'HH:mm:ss (example: 1984-12-28T10:10:00).

End dates - best practices

If you intend to include an entire day in your report, make sure you set the endDate to the following day at 00:00:00. For instance, if you need the report to cover the entire day of Sept. 1, 2024, you would set:

"startDate": "2024-09-01T00:00:00",
"endDate": "2024-09-02T00:00:00",

Requesting a report with "endDate": "2024-09-01T23:59:59" would include reporting data from 2024-09-01T00:00:00 till 2024-09-01T23:00:00. 

Timezone

The Timezone field sets the timezone of the report and can take the values:

  • Network - sets the timezone to the timezone specified in the given Equativ customer network; it is usually specified during the initial setup process, i. e. when customers start working with Equativ
  • UTC - sets the timezone to UTC

Filtering

Operators

The following operators can be used for filtering:

Operator nameOperator full nameApplied to data typeDescription

contains

containsSTRINGkeeps only values contained in an element of the given list
gtgreater thanINTEGERkeeps only values greater than the provided value
ininINTEGER or STRINGkeeps only values in the provided list
isisBOOLEANkeeps only values equal to the provided value
ltless thanINTEGERkeeps only values less than the unique provided value
not_innot inINTEGERkeeps only values different from the provided list

Filtering sample

The report configuration sample below requests a report with the following filter criteria: InsertionId=123 AND (EnvironmentTypeId=0 OR CountryId=11)


 
{
    "reportName": "doc_sample_4_filters",
      "StartDate": "2023-10-01T00:00:00",
      "EndDate": "2023-10-02T00:00:00",
    "metrics": [
        "Impressions"
    ],
    "dimensions": [
        "EnvironmentTypeName",
        "CountryName"
    ],
    "filters": [
        [
            {
                "Field": "InsertionId",
                "Operator": "IN",
                "Values": [
                    123
                ]
            }
        ],
        [
            {
                "Field": "EnvironmentTypeId",
                "Operator": "IN",
                "Values": [
                    0
                ]
            },
            {
                "Field": "CountryId",
                "Operator": "IN",
                "Values": [
                    11
                ]
            }
        ]
    ],
    "dateFormat": "yyyy-MM-dd",
    "onFinishEmails": [
        "example@example.com"
    ],
    "timezone": "UTC",
    "useCaseId": "Adserving"


Note that filter criteria within the same list (i. e. criteria inside the same pair of square brackets) are connected using the OR operator. Lists of criteria are connected with other lists of criteria using the AND operator.

The sample below shows the first rows of the generated csv report file for the report configuration above:

EnvironmentTypeNameCountryNameImpressions
Webcosta rica17
Webtunisia0
Webestonia0
Webparaguay0
Webguatemala15
Webhaiti3
Webel salvador7
Webcolombia2
Webspain2
Webrussian federation0

Report scheduling

You can use report scheduling to have a report generated on a regular basis.

Scheduled report sample

The sample below shows a report configuration for a scheduled report, generated once per day, containing data of the previous day.

{
      "reportName": "doc_sample_5_scheduling",
      "metrics": [
         "impressions"
      ],
      "dimensions": [
            "insertionName"
  ],
  "dateFormat": "yyyy-MM-dd",
  "onFinishEmails": [
      "example@example.com"
  ],
  "timezone": "UTC",
  "useCaseId": "RTB",
  "scheduling": {
       "frequency": "DAILY",
        "period": "PREVIOUS_DAY",
       "schedulingStartDate": "2023-10-16T11:05:00",
       "schedulingEndDate": "2023-10-19T00:00:00"
      }
}


This table summarizes all report instances the sample above will generate:

Report #Date/TimeData contained in report
1Oct. 16, 2023 at 11:05data from Oct. 15, 2023
2Oct. 17, 2023 at 11:05data from Oct. 16, 2023
3Oct. 18, 2023 at 11:05data from Oct. 17, 2023

 

Frequency of scheduled reports

The frequency value in scheduled reports defines the recurrence of the report:

Frequency valueFrequency descriptionExample
FIXED_DATE/yyyy-MM-dd'T'HH:mm:ssonce, at the specified dateFIXED_DATE/2016-07-27T17:00:00
HOURLYevery hour 
HOURLY*xevery x hoursHOURLY*4
DAILYevery day 
DAILY*xevery x daysDAILY*4
WEEKLYevery week 
WEEKLY*xevery x weeksWEEKLY*4
MONTHLYevery month 
MONTHLY*xevery x monthsMONTHLY*2

Period of scheduled reports

The period value in scheduled reports defines the time frame each instance of the scheduled report will cover; for instance PREVIOUS_DAY means that each report will contain data from the previous day. The period field supports the following values:

  • LAST_HOUR
  • CURRENT_DAY
  • PREVIOUS_DAY
  • LAST_7_DAYS
  • PREVIOUS_WEEK
  • CURRENT_MONTH
  • PREVIOUS_MONTH

Consolidation of reporting data for previous day

The consolidation of reporting data for any given day is completed within the first 6 hours (UTC) of the following day. Generating a report before the consolidation is completed leads to incomplete reporting data for the previous day.
For instance, if you set up a scheduled report with "frequency": "DAILY" and "period": "PREVIOUS_DAY", make sure you set the UTC time in  "schedulingStartDate" to a value no earlier than T06:00:00 (for instance: "schedulingStartDate": "2024-10-16T06:00:00").

Relative dates

The following relative dates can be used in date fields:

Value________________________DescriptionExample value______________Example value meaning
CURRENT_DAY+-xthe current day at midnight (0 hours, 0 minutes, 0 seconds, 0 ms), with the specified modifierCURRENT_DAY-1
CURRENT_DAY+1
yesterday
tomorrow at midnight
CURRENT_HOUR+-xthe current hour (lowered to the 0th minute) with the specified modifierCURRENT_HOUR+115h00 (e. g. if the current time is 14h45)
CURRENT_WEEK+-xthe current week (lowered to Monday morning at 00h00) with the specified modifierCURRENT_WEEK+1Monday morning at 00h00 in the upcoming week (e. g. if today is Wednesday)
CURRENT_MONTH+-xthe current month (lowered to the first day of the month at 00h00) with the specified modifierCURRENT_MONTH+101 November at 00h00 (e. g. if today is 16th October)

Delete report

Use the DELETE method to delete a one-time or a scheduled report. For more information, see section "Base URL and endpoints"  in Reporting API – Getting started.


Output format

File format

You can specify the file format of the report, using the FileFormat parameter:

  • csv sets the file format to csv format (default format, applied if FileFormat is not specified)
  • xlsx sets the file format to Excel format

The example report configuration below shows the FileFormat field set to xlsx.

{
    "ReportName": "Reporting-Smart-20240619",
    "OnFinishEmails": [
        
    ],
    "StartDate": "2024-06-18T00:00:00",
    "EndDate": "2024-06-19T00:00:00",
    "Simulate": false,
    "Metrics": [
        {
            "Field": "Impressions"
        }
    ],
    "Dimensions": [
        "Attstatus"
    ],
    "Filters": [
        [
            
            {
                "Field": "PublisherId",
                "Operator": "IN",
                "Values": [
                    3491
                ]
            }
        ]
    ],
    "AllFilterFields": [],
    "DateFormat": "yyyy-MM-dd",
    "UseCaseId": "Adserving",
    "Separator": "\t",
    "FileFormat": "xlsx"
}

 

Custom column separator in csv reports

If FileFormat is set to csv or if it is not specified, you can specify a custom column separator (default separator: comma):

  • \t in order to obtain a report containing tab separated values
  • any other character, provided it is not longer than one single character.

The example report configuration below requests a report with tab separated values ("Separator": "\t") :
 

{
    "ReportName": "Reporting-Smart-20240619",
    "OnFinishEmails": [
        
    ],
    "StartDate": "2024-06-18T00:00:00",
    "EndDate": "2024-06-19T00:00:00",
    "Simulate": false,
    "Metrics": [
        {
            "Field": "Impressions"
        }
    ],
    "Dimensions": [
        "Attstatus"
    ],
    "Filters": [
        [
            
            {
                "Field": "PublisherId",
                "Operator": "IN",
                "Values": [
                    3491
                ]
            }
        ]
    ],
    "AllFilterFields": [],
    "DateFormat": "yyyy-MM-dd",
    "UseCaseId": "Adserving",
    "Timezone": "Network",
    "FileFormat": "csv",
    "Separator": "\t"
}

Powered by