StarThinker
Published in

StarThinker

Campaign Manager Command Line Report Inspecting Tool

To speed up working with the Campaign Manager API and specifically the reports endpoint, we’ve created a command line tool to help with the following:

  • List existing reports — verify one exists.
st_cm --account [id] --list -u [user credentials path]
  • Get the report definition — verify it has the correct fields.
st_cm --account [id] --report [id] -u [user credentials path]
  • List report files — verify data exists.
st_cm --account [id] --files [id] -u [user credentials path]
  • Inspect rows of data from a report — verify values are correct.
st_cm --account [id] --sample [id] -u [user credentials path]
  • Produce BigQuery compatible report schema — for pasting into code.
st_cm --account [id] --schema [id] -u [user credentials path]
  • Produce StarThinker compatible task — for creating a workflow.
st_cm --account [id] --report [id] -u [user credentials path]

To use the command line tool install it (Or clone it from GitHub, using these instructions ):

python3 -m pip install starthinker

Then generate the user credentials by following instructions for the following command, if using -u or -s for service credentials:

st_auth -h

The st_cm command is ready. For example here is the schema for a report:

python3 -m pip install starthinker
st_cm --account 7480 --schema 858250087 -u user.json
DCM REPORT CLEAN
Download 100%
[
{
"mode": "NULLABLE",
"name": "Report_Day",
"type": "DATE"
},
{
"mode": "NULLABLE",
"name": "Advertiser_Id",
"type": "INTEGER"
},
{
"mode": "NULLABLE",
"name": "Campaign_Id",
"type": "INTEGER"
},
{
"mode": "NULLABLE",
"name": "Ad_Id",
"type": "INTEGER"
},
{
"mode": "NULLABLE",
"name": "Placement_Id",
"type": "INTEGER"
},
{
"mode": "NULLABLE",
"name": "Platform_Type",
"type": "STRING"
},
{
"mode": "NULLABLE",
"name": "Zip_Postal_Code",
"type": "STRING"
},
{
"mode": "NULLABLE",
"name": "Impressions",
"type": "INTEGER"
},
{
"mode": "NULLABLE",
"name": "Clicks",
"type": "INTEGER"
},
{
"mode": "NULLABLE",
"name": "Total_Conversions",
"type": "FLOAT"
},
{
"mode": "NULLABLE",
"name": "Media_Cost",
"type": "FLOAT"
}
]

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store