This repository was archived by the owner on Jul 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathtransparency.json
More file actions
executable file
·243 lines (243 loc) · 10.3 KB
/
transparency.json
File metadata and controls
executable file
·243 lines (243 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
{
"script": {
"released":"2019-08-19",
"license":"Licensed under the Apache License, Version 2.0",
"copyright":"Copyright 2020 Google LLC",
"icon":"fingerprint",
"title":"CM360 Domain And App Transparency",
"description":"Reports the percentage of CM impressions that can be attributed to a specific domain or application. Allows diagnostic of which domains and apps are misconfigured by publisher resulting in underreporting.",
"image":"https://google.github.io/starthinker/static/transparency.png",
"sample":"https://datastudio.google.com/c/u/0/reporting/1foircGRxgYCL_PR8gfdmYOleBacnPKwB/page/QCXj",
"from":["cm360"],
"to":["bigquery", "datastudio"],
"pitches":[
"Measure mix of domain and app traffic.",
"Discover which sites are underepporting.",
"Measure advertiser and campaign level transparency.",
"Determine which dimensions have lowest transparency."
],
"impacts":{
"spend optimization":0,
"spend growth":0,
"time savings":90,
"account health":100,
"csat improvement":100
},
"instructions":[
"Wait for [BigQuery : {field:recipe_project} : {field:recipe_slug} : {field:recipe_slug, prefix:Transparency_Domain_}](https://console.cloud.google.com/bigquery?project={field:recipe_project}&d={field:recipe_slug}) to be created.",
"Copy DataStudio [Transparency Combined KPI](https://datastudio.google.com/c/u/0/datasources/1Az6d9loAHo69GSIyKUfusrtyf_IDqTVs) and connect.",
"Copy DataStudio [Transparency Breakdown](https://datastudio.google.com/c/u/0/reporting/1foircGRxgYCL_PR8gfdmYOleBacnPKwB/page/QCXj).",
"When prompted choose the new data source you just created.",
"Or give these intructions to the client, they will have to join the [StarThinker Assets Group](https://groups.google.com/d/forum/starthinker-assets)."
],
"authors":["kenjora@google.com"]
},
"tasks": [
{ "dataset": {
"hour":[1],
"auth": "service",
"dataset":{"field":{ "name":"recipe_slug", "kind":"string", "order":1, "default":"", "description":"Name of Google BigQuery dataset to create." }}
}},
{ "dcm": {
"hour":[2],
"auth": "user",
"report": {
"account":{"field":{ "name":"dcm_account", "kind":"integer", "order":2, "default":"", "description":"CM account id of client." }},
"filters": {
"advertiser": {
"values":{"field":{ "name":"dcm_advertisers", "kind":"integer_list", "order":3, "description":"Comma delimited list of CM advertiser ids." }}
}
},
"body":{
"type": "STANDARD",
"format": "CSV",
"name":{"field":{ "name":"recipe_name", "kind":"string", "prefix":"Transparency App For ", "description":"Name of report in CM, unique." }},
"criteria": {
"dateRange": { "relativeDateRange": "PREVIOUS_MONTH" },
"dimensions": [
{ "name": "advertiser" },
{ "name": "advertiserId" },
{ "name": "campaign" },
{ "name": "campaignId" },
{ "name": "siteId" },
{ "name": "site" },
{ "name": "adType" },
{ "name": "environment" },
{ "name": "appId" },
{ "name": "app" }
],
"metricNames": [ "impressions" ]
},
"schedule": {
"active": true,
"every": 1,
"repeats": "MONTHLY",
"runsOnDayOfMonth": "DAY_OF_MONTH"
}
}
}
}},
{ "dcm": {
"hour":[2],
"auth": "user",
"report": {
"account":{"field":{ "name":"dcm_account", "kind":"integer", "order":2, "default":"", "description":"CM account id of client." }},
"filters": {
"advertiser": {
"values":{"field":{ "name":"dcm_advertisers", "kind":"integer_list", "order":3, "description":"Comma delimited list of CM advertiser ids." }}
}
},
"body": {
"type": "STANDARD",
"format": "CSV",
"name":{"field":{ "name":"recipe_name", "kind":"string", "prefix":"Transparency Domain For ", "description":"Name of report in CM, unique." }},
"criteria": {
"dateRange": { "relativeDateRange": "PREVIOUS_MONTH" },
"dimensions": [
{ "name": "advertiser" },
{ "name": "advertiserId" },
{ "name": "campaign" },
{ "name": "campaignId" },
{ "name": "site" },
{ "name": "siteId" },
{ "name": "adType" },
{ "name": "domain" }
],
"metricNames": [
"verificationVerifiableImpressions"
]
},
"schedule": {
"active": true,
"every": 1,
"repeats": "MONTHLY",
"runsOnDayOfMonth": "DAY_OF_MONTH"
}
}
}
}},
{ "dcm": {
"hour":[4],
"auth": "user",
"report": {
"account":{"field":{ "name":"dcm_account", "kind":"integer", "order":2, "default":"", "description":"CM account id of client." }},
"name":{"field":{ "name":"recipe_name", "kind":"string", "prefix":"Transparency Domain For ", "description":"Name of report in CM, should be unique." }}
},
"out": {
"bigquery": {
"auth": "service",
"dataset":{"field":{ "name":"recipe_slug", "kind":"string", "order":1, "default":"", "description":"Name of Google BigQuery dataset to create." }},
"table": "Transparency_Domain_KPI"
}
}
}},
{ "dcm": {
"hour":[4],
"auth": "user",
"report": {
"account":{"field":{ "name":"dcm_account", "kind":"integer", "order":2, "default":"", "description":"CM account id of client." }},
"name":{"field":{ "name":"recipe_name", "kind":"string", "prefix":"Transparency App For ", "description":"Name of report in CM, should be unique." }}
},
"out": {
"bigquery": {
"auth": "service",
"dataset":{"field":{ "name":"recipe_slug", "kind":"string", "order":1, "default":"", "description":"Name of Google BigQuery dataset to create." }},
"table": "Transparency_App_KPI"
}
}
}},
{ "bigquery": {
"hour":[5],
"auth": "user",
"to": {
"dataset":{"field":{ "name":"recipe_slug", "kind":"string", "order":1, "default":"", "description":"Name of Google BigQuery dataset to create." }},
"view": "Transparency_Combined_KPI"
},
"from": {
"query": "WITH
Transparent_Domains AS (
SELECT
CONCAT(Advertiser, ' - ', CAST(Advertiser_Id AS STRING)) AS Advertiser,
CONCAT(Campaign, ' - ', CAST(Campaign_Id AS STRING)) AS Campaign,
CONCAT(Site_Cm360, ' - ', CAST(Site_Id_Cm360 AS STRING)) AS Site,
Domain,
Ad_Type,
Verifiable_Impressions AS Impressions,
IF(Domain IS NOT NULL, Verifiable_Impressions, 0) AS Visible_Impressions,
IF(Domain IS NULL, Verifiable_Impressions, 0) AS Null_Impressions
FROM `{dataset}.Transparency_Domain_KPI`
),
Transparent_Apps AS (
SELECT
CONCAT(Advertiser, ' - ', CAST(Advertiser_Id AS STRING)) AS Advertiser,
CONCAT(Campaign, ' - ', CAST(Campaign_Id AS STRING)) AS Campaign,
CONCAT(Site_Cm360, ' - ', CAST(Site_Id_Cm360 AS STRING)) AS Site,
/*If(App IS NOT NULL, CONCAT(App, ' - ', CAST(App_Id AS STRING)), App_Id) AS App, */
CASE
WHEN App IS NOT NULL THEN CONCAT(App, ' - ', CAST(App_Id AS STRING))
WHEN App_Id IS NOT NULL THEN App_Id
ELSE NULL
END AS App,
Ad_Type,
Impressions,
IF(App IS NOT NULL OR App_ID IS NOT NULL, Impressions, 0) AS Visible_Impressions,
IF(App IS NULL AND App_Id IS NULL, Impressions, 0) AS Null_Impressions
FROM `{dataset}.Transparency_App_KPI` WHERE Environment = 'App'
),
Domains_And_Apps AS (
SELECT
TD.Advertiser,
TD.Campaign,
TD.Site,
TD.Ad_Type,
TD.Domain,
TD.Impressions AS Domain_Impressions,
TD.Visible_Impressions AS Domain_Visible_Impressions,
TD.Null_Impressions AS Domain_Null_Impressions,
NULL AS App,
0 AS App_Impressions,
0 AS App_Visible_Impressions,
0 AS App_Null_Impressions FROM Transparent_Domains AS TD UNION ALL SELECT
TA.Advertiser,
TA.Campaign,
TA.Site,
TA.Ad_Type,
NULL AS Domain,
0 AS Domain_Impressions,
0 AS Domain_Visible_Impressions,
0 AS Domain_Null_Impressions,
TA.App,
TA.Impressions AS App_Impressions,
TA.Visible_Impressions AS App_Visible_Impressions,
TA.Null_Impressions AS App_Null_Impressions
FROM Transparent_Apps AS TA
)
SELECT
Advertiser,
Campaign,
Site,
COALESCE(Domain, App, '') AS Domain_Or_App,
Ad_Type,
CASE
WHEN App IS NOT NULL AND Domain IS NOT NULL THEN 'Both' /* SHOULD NOT HAPPEN */
WHEN App IS NOT NULL THEN 'App'
WHEN Domain IS NOT NULL Then 'Domain'
ELSE 'Neither'
END AS Category,
SUM(Domain_Impressions) AS Domain_Impressions,
SUM(Domain_Visible_Impressions) AS Domain_Visible_Impressions,
SUM(Domain_Null_Impressions) AS Domain_Null_Impressions,
SUM(App_Impressions) AS App_Impressions,
SUM(App_Visible_Impressions) AS App_Visible_Impressions,
SUM(App_Null_Impressions) AS App_Null_Impressions,
SUM(App_Impressions + Domain_Impressions) AS Impressions
/* Could also be MAX as its always one or the other*/
FROM Domains_And_Apps GROUP By 1,2,3,4,5,6",
"parameters":{
"dataset":{"field":{ "name":"recipe_slug", "kind":"string", "description":"Place where tables will be written in BigQuery." }}
},
"legacy": false
}
}}
]
}