Skip to content

Commit f06a427

Browse files
authored
Gam functionality
1 parent 9a6ba74 commit f06a427

File tree

16 files changed

+2105
-99
lines changed

16 files changed

+2105
-99
lines changed

.env.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# [ad_server]
2-
TRUSTED_SERVER__AD_SERVER__AD_PARTNER_BACKEND=http://127.0.0.1:10180
2+
TRUSTED_SERVER__AD_SERVER__AD_PARTNER_URL=http://127.0.0.1:10180
33

44
# [synthetic]
55
TRUSTED_SERVER__SYNTHETIC__COUNTER_STORE=counter_store

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3333
- Added publisher config
3434
- Add AI assist rules. Based on https://github.com/hashintel/hash
3535
- Added ability to construct GAM requests from static permutive segments with test pages
36+
- Add more complete e2e GAM (Google Ad Manager) integration with request construction and ad serving capabilities
37+
- Add new partners.rs module for partner-specific configurations
38+
- Created comprehensive publisher IDs audit document identifying hardcoded values
3639

3740
### Changed
3841
- Upgrade to rust 1.87.0

PUBLISHER_IDS_AUDIT.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Publisher-Specific IDs Audit
2+
3+
This document lists all publisher-specific IDs and configurations found in the codebase that are currently hardcoded to test publisher values.
4+
5+
## Configuration Files
6+
7+
### trusted-server.toml
8+
9+
**GAM Configuration:**
10+
- `publisher_id = "3790"` (line 14)
11+
- `server_url = "https://securepubads.g.doubleclick.net/gampad/ads"` (line 15)
12+
13+
**Equativ Configuration:**
14+
- `sync_url = "https://adapi-srv-eu.smartadserver.com/ac?pgid=2040327&fmtid=137675&synthetic_id={{synthetic_id}}"` (line 8)
15+
- Page ID: `2040327`
16+
- Format ID: `137675`
17+
18+
**Test Publisher Domain:**
19+
- `domain = "test-publisher.com"` (line 2)
20+
- `cookie_domain = ".test-publisher.com"` (line 3)
21+
- `origin_url = "https://origin.test-publisher.com"` (line 4)
22+
23+
**KV Store Names (user-specific):**
24+
- `counter_store = "jevans_synth_id_counter"` (line 24)
25+
- `opid_store = "jevans_synth_id_opid"` (line 25)
26+
27+
## Hardcoded in Source Code
28+
29+
### /Users/jevans/trusted-server/crates/common/src/gam.rs
30+
31+
**Permutive Segment Data (lines 295 and 486):**
32+
```rust
33+
.with_prmtvctx("129627,137412,138272,139095,139096,139218,141364,143196,143210,143211,143214,143217,144331,144409,144438,144444,144488,144543,144663,144679,144731,144824,144916,145933,146347,146348,146349,146350,146351,146370,146383,146391,146392,146393,146424,146995,147077,147740,148616,148627,148628,149007,150420,150663,150689,150690,150692,150752,150753,150755,150756,150757,150764,150770,150781,150862,154609,155106,155109,156204,164183,164573,165512,166017,166019,166484,166486,166487,166488,166492,166494,166495,166497,166511,167639,172203,172544,173548,176066,178053,178118,178120,178121,178133,180321,186069,199642,199691,202074,202075,202081,233782,238158,adv,bhgp,bhlp,bhgw,bhlq,bhlt,bhgx,bhgv,bhgu,bhhb,rts".to_string())
34+
```
35+
36+
This large string contains Permutive segment IDs that appear to be captured from a specific test publisher's live traffic.
37+
38+
### /Users/jevans/trusted-server/crates/common/src/prebid.rs
39+
40+
**Equativ Integration:**
41+
- `"pageId": 2040327` (matches config)
42+
- `"formatId": 137675` (matches config)
43+
44+
### Test Files
45+
46+
**Test Support Files:**
47+
- GAM publisher ID `"3790"` in test configurations
48+
- `"test-publisher.com"` and related test domains in multiple test files
49+
50+
## Impact Assessment
51+
52+
### High Priority (Publisher-Specific)
53+
1. **GAM Publisher ID (3790)** - Core identifier for ad serving
54+
2. **Permutive Segments** - Large hardcoded segment string from test traffic
55+
3. **Equativ Page/Format IDs (2040327, 137675)** - Ad network integration
56+
57+
### Medium Priority (Environment-Specific)
58+
1. **Test Publisher Domains** - Should be configurable per deployment
59+
2. **KV Store Names** - Currently user-specific (jevans_*)
60+
61+
### Low Priority (Infrastructure)
62+
1. **Server URLs** - Generally standard but should be configurable
63+
64+
## Recommendations
65+
66+
1. Move hardcoded Permutive segments to configuration
67+
2. Make GAM publisher ID environment-specific
68+
3. Make Equativ IDs configurable per publisher
69+
4. Generalize KV store naming convention
70+
5. Create publisher-specific configuration templates
71+
72+
## Files to Update
73+
74+
- `trusted-server.toml` - Add permutive segments configuration
75+
- `crates/common/src/gam.rs` - Remove hardcoded segments (lines 295, 486)
76+
- `crates/common/src/prebid.rs` - Use configuration for Equativ IDs
77+
- Test files - Use environment-agnostic test data

crates/common/src/advertiser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub fn handle_ad_request(
147147
log::info!(" {}: {:?}", name, value);
148148
}
149149

150-
match ad_req.send(settings.ad_server.ad_partner_backend.as_str()) {
150+
match ad_req.send(settings.ad_server.ad_partner_url.as_str()) {
151151
Ok(mut res) => {
152152
log::info!(
153153
"Received response from backend with status: {}",

crates/common/src/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub enum TrustedServerError {
3838
/// GAM (Google Ad Manager) integration error.
3939
#[display("GAM error: {message}")]
4040
Gam { message: String },
41+
4142
/// GDPR consent handling error.
4243
#[display("GDPR consent error: {message}")]
4344
GdprConsent { message: String },

0 commit comments

Comments
 (0)