Skip to content

Add GAM interceptor integration - backend#240

Draft
aram356 wants to merge 1 commit intofeature/integration-head-injectorfrom
feature/gam-integration-backend
Draft

Add GAM interceptor integration - backend#240
aram356 wants to merge 1 commit intofeature/integration-head-injectorfrom
feature/gam-integration-backend

Conversation

@aram356
Copy link
Collaborator

@aram356 aram356 commented Feb 5, 2026

Summary

  • Adds GamIntegrationConfig with enabled, bidders, and force_render options
  • Implements IntegrationHeadInjector to inject GAM config script into <head>
  • Registers GAM integration in the integration builder system
  • Adds unit tests for config script generation

Configuration

[integrations.gam]
enabled = true
bidders = ["mocktioneer"]  # Only intercept these bidders, empty = all
force_render = false       # Force render even if GAM has a line item

Or via environment variables:

TRUSTED_SERVER__INTEGRATIONS__GAM__ENABLED=true
TRUSTED_SERVER__INTEGRATIONS__GAM__BIDDERS="mocktioneer,appnexus"

The injected script sets window.tsGamConfig which is picked up by the client-side GAM interceptor on initialization.

Test plan

  • Verify cargo check passes
  • Verify cargo test -p trusted-server-common passes
  • Enable GAM integration in config and verify <script>window.tsGamConfig=...</script> appears in HTML head
  • Verify config values (bidders, forceRender) are correctly serialized

Dependencies

Closes #248
Related to #179

- Add `GamIntegrationConfig` with enabled, bidders, and force_render options
- Implement `IntegrationHeadInjector` to inject GAM config script into <head>
- Register GAM integration in the integration builder system
- Add unit tests for config script generation

Configuration example:
```toml
[integrations.gam]
enabled = true
bidders = ["mocktioneer"]  # Only intercept these bidders, empty = all
force_render = false       # Force render even if GAM has a line item
```

The injected script sets `window.tsGamConfig` which is picked up by the
client-side GAM interceptor on initialization.
@aram356 aram356 self-assigned this Feb 5, 2026
@aram356 aram356 marked this pull request as draft February 5, 2026 18:05
@aram356 aram356 added enhancement New feature or request and removed enhancement New feature or request labels Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant