Skip to content

Commit c44b25c

Browse files
authored
accounts config doc updates (#1096)
Adding detail and transitions around the accounts config
1 parent 55a4d9c commit c44b25c

File tree

1 file changed

+49
-22
lines changed

1 file changed

+49
-22
lines changed

docs/application-settings.md

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ There are two ways to configure application settings: database and file. This do
2525
- `analytics-config.auction-events.<channel>` - defines which channels are supported by analytics for this account
2626
- `bid-validations.banner-creative-max-size` - Overrides creative max size validation for banners.
2727

28+
Here are the definitions of the "purposes" that can be defined in the GDPR setting configurations:
2829
```
2930
Purpose | Purpose goal | Purpose meaning for PBS (n\a - not affected)
3031
----------|---------------------------------|---------------------------------------------
@@ -43,22 +44,26 @@ sf1 | Precise geo | Verifies user opt-in. If the user
4344
sf2 | Fingerprinting | n\a
4445
```
4546

46-
## File application setting
47+
## Setting Account Configuration in Files
4748

4849
In file based approach all configuration stores in .yaml files, path to which are defined in application properties.
4950

5051
### Configuration in application.yaml
5152

53+
The general idea is that you'll place all the account-specific settings in a separate YAML file and point to that file.
54+
5255
```yaml
5356
settings:
5457
filesystem:
5558
settings-filename: <directory to yaml file with settings>
5659
```
5760
### File format
5861
62+
Here's an example YAML file containing account-specific settings:
63+
5964
```yaml
6065
accounts:
61-
- id: 14062
66+
- id: 1111
6267
bannerCacheTtl: 100
6368
videoCacheTtl: 100
6469
eventsEnabled: true
@@ -152,7 +157,7 @@ accounts:
152157
purpose-one-treatment-interpretation: ignore
153158
```
154159
155-
## Database application setting
160+
## Setting Account Configuration in the Database
156161
157162
In database approach account properties are stored in database table.
158163
@@ -171,10 +176,20 @@ settings:
171176
account-query: <SQL query for account>
172177
```
173178
174-
### SQL query for account requirements
179+
### Configurable SQL query for account requirements
180+
181+
The general approach is that each host company can set up their database however they wish, so long as the configurable query run by
182+
Prebid Server returns expected data in the expected order. Here's an example configuration:
183+
184+
```yaml
185+
settings:
186+
database:
187+
type: mysql
188+
account-query: SELECT uuid, price_granularity, banner_cache_ttl, video_cache_ttl, events_enabled, enforce_ccpa, tcf_config, analytics_sampling_factor, truncate_target_attr, default_integration, analytics_config, bid_validations FROM accounts_account where uuid = ? LIMIT 1
189+
```
175190
176191
The SQL query for account must:
177-
* return following columns, with specified type, in that order:
192+
* return following columns, with specified type, in this order:
178193
* account ID, string
179194
* price granularity, string
180195
* banner cache TTL, integer
@@ -191,7 +206,19 @@ runtime
191206

192207
It is recommended to include `LIMIT 1` clause in the query because only the very first result returned will be taken.
193208

194-
TCF configuration column format:
209+
If a host company doesn't support a given field, or they have a different table name, they can just update the query with whatever values are needed. e.g.
210+
211+
```yaml
212+
settings:
213+
database:
214+
type: mysql
215+
account-query: SELECT uuid, 'med', banner_cache_ttl, video_cache_ttl, events_enabled, enforce_ccpa, tcf_config, 0, null, default_integration, '{}', '{}' FROM myaccountstable where uuid = ? LIMIT 1
216+
```
217+
### Configuration Details
218+
219+
#### TCF configuration JSON
220+
221+
Here's an example of the value that the `tcf_config` column can take:
195222

196223
```json
197224
{
@@ -304,30 +331,39 @@ TCF configuration column format:
304331
}
305332
```
306333

307-
and bid_validations column is json with next format
334+
#### Bid Validations configuration JSON
335+
336+
The `bid_validations` column is json with this format:
308337

309338
```json
310339
{
311340
"banner-creative-max-size": "enforce"
312341
}
313342
```
314343

344+
Valid values are:
345+
- "skip": don't do anything about creative max size for this publisher
346+
- "warn": if a bidder returns a creative that's larger in height or width than any of the allowed sizes, log an operational warning.
347+
- "enforce": if a bidder returns a creative that's larger in height or width than any of the allowed sizes, reject the bid and log an operational warning.
315348

316-
Analytics configuration column format:
349+
#### Analytics Validations configuration JSON
350+
351+
The `analytics_config` configuration column format:
317352

318353
```json
319354
{
320355
"auction-events": {
321-
"web": true,
322-
"amp": true,
323-
"app": false
356+
"web": true, // the analytics adapter should log auction events when the channel is web
357+
"amp": true, // the analytics adapter should log auction events when the channel is AMP
358+
"app": false // the analytics adapter should not log auction events when the channel is app
324359
}
325360
}
326361
```
327362

328-
#### Example
363+
#### Creating the accounts table
329364

330-
Query to create accounts_account table:
365+
Traditionally the table name used by Prebid Server is `accounts_account`. No one remembers why. But here's SQL
366+
you could use to create your table:
331367

332368
```sql
333369
'CREATE TABLE `accounts_account` (
@@ -354,12 +390,3 @@ PRIMARY KEY (`id`),
354390
UNIQUE KEY `uuid` (`uuid`))
355391
ENGINE=InnoDB DEFAULT CHARSET=utf8'
356392
```
357-
358-
Query used to get an account:
359-
360-
```sql
361-
SELECT uuid, price_granularity, banner_cache_ttl, video_cache_ttl, events_enabled, enforce_ccpa, tcf_config,
362-
analytics_sampling_factor, truncate_target_attr, default_integration, analytics_config, bid_validations
363-
FROM accounts_account where uuid = %ACCOUNT_ID%
364-
LIMIT 1
365-
```

0 commit comments

Comments
 (0)