-
Notifications
You must be signed in to change notification settings - Fork 16
feat: Add tracking pixel macro substitution for GAM adapter #944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
BaiyuScope3
merged 10 commits into
adcontextprotocol:main
from
igorantun:igorantun/tracking-pixels
Jan 16, 2026
Merged
feat: Add tracking pixel macro substitution for GAM adapter #944
BaiyuScope3
merged 10 commits into
adcontextprotocol:main
from
igorantun:igorantun/tracking-pixels
Jan 16, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add AdCP-to-GAM macro mapping utilities for tracking URLs:
- Map AdCP universal macros ({CACHEBUSTER}, {GDPR}, etc.) to GAM equivalents
- Support multiple GAM macro formats (%%MACRO%%, ${MACRO}, %macro!)
- Passthrough unmapped macros to preserve third-party tracking
- Fix tracking URL field path in creatives manager
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
|
All contributors have agreed to the IPR Policy. Thank you! |
Contributor
Author
|
I have read the IPR Policy |
igorantun
commented
Jan 8, 2026
igorantun
commented
Jan 8, 2026
bokelley
reviewed
Jan 10, 2026
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3784539 to
029a784
Compare
bokelley
requested changes
Jan 12, 2026
Contributor
bokelley
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure click urls work with GAM click tracking, that imp trackers fire properly, and that axem is filled out. use wonderstruck
- Fix impression tracking for ImageRedirectCreative and CustomCreative
to use thirdPartyImpressionTrackingUrls field
- Fix VideoRedirectCreative to use trackingUrls with CREATIVE_VIEW event
- Map {AXEM} to %{AXEM} (prebid macro format)
- Remove click tracking URL handling - clicks should be tracked via
macros in the creative snippet per GAM documentation
- Add unit tests for creative type field mapping
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Click tracking works via redirection: GAM → click tracker → landing page The click tracker URL is set as destinationUrl, which redirects to final landing page after tracking the click. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
f807948 to
c3eeab7
Compare
igorantun
commented
Jan 15, 2026
- Add tracker_redirect url_type handling in creative_helpers.py
- Click tracker URL now always replaces destinationUrl
- {REDIRECTION_URL} macro is replaced with original destination (URL-encoded)
- Flow: GAM → click tracker → landing page
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…RL macro
- Change {REDIRECTION_URL} to {REDIRECT_URL} in GAM creatives.py
- Add role name fallback for impression_tracker (impression_tracker, tracker_pixel, pixel)
- Add role name fallback for click_tracker (click_tracker, tracker_redirect, redirect_tracker)
- Update tests to use REDIRECT_URL macro name
This makes url_type optional for trackers, matching the existing click_url behavior.
- Click tracker without {REDIRECT_URL} macro is now ignored when landing page exists
(prevents losing landing page URL)
- Add warning for click tracker missing {REDIRECT_URL} macro
- Add warning for click tracker with {REDIRECT_URL} but no landing page
- Add warning when multiple click trackers provided (only first is used)
- Fix: Native creatives now call _add_tracking_urls_to_creative
- Fix: TemplateCreative (native) now handled in tracking URL logic
- Update tests to reflect new behavior
…ontext The adapters were passing tenant_gemini_key as the 5th positional argument, but build_order_name_context() has tenant_ai_config as the 5th parameter. This caused the string API key to be treated as an AI config object, resulting in: 'str' object has no attribute 'api_key' Changes: - src/adapters/google_ad_manager.py: Use keyword arg tenant_gemini_key= - src/adapters/mock_ad_server.py: Use keyword arg tenant_gemini_key= - src/adapters/gam/managers/workflow.py: Use keyword arg tenant_gemini_key= - tests/unit/test_naming_parameter_bug.py: Add test documenting the bug - tests/unit/conftest.py: Fix mock to prevent MagicMock type leakage - tests/unit/test_gam_workflow_packages.py: Fix mock configuration
BaiyuScope3
reviewed
Jan 16, 2026
Collaborator
BaiyuScope3
approved these changes
Jan 16, 2026
bokelley
approved these changes
Jan 16, 2026
Fixes mypy errors: - src/core/helpers/creative_helpers.py:360 - Item 'str' of 'list[str] | str' has no attribute 'append' - src/core/helpers/creative_helpers.py:369 - Item 'str' of 'list[str] | str' has no attribute 'append' Uses the same pattern already established on lines 350-352.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Summary
src/adapters/gam/utils/macros.py{CACHEBUSTER},{GDPR},{AXEM}, etc.) to their GAM equivalents%%MACRO%%(standard),${MACRO}(GDPR/TCF),%macro!(expand),%{MACRO}(prebid)ThirdPartyCreative,ImageRedirectCreative,CustomCreative→thirdPartyImpressionTrackingUrlsVideoRedirectCreative→trackingUrlswithCREATIVE_VIEWeventtracker_redirecturl_type support in creative_helpers.py for click trackingdestinationUrl, with{REDIRECTION_URL}substituted with original landing page (URL-encoded)Macro Mapping Highlights
{CACHEBUSTER}%%CACHEBUSTER%%{GDPR}${GDPR}{CLICK_URL}%%CLICK_URL_ESC%%{PLACEMENT_ID}%epid!{AXEM}%{AXEM}{REDIRECTION_URL}{GDPR_CONSENT}{GPP_STRING}Tracking Flow
tracker_pixel/tracker_scriptassets added tothirdPartyImpressionTrackingUrlstracker_redirectassets replacedestinationUrl, redirecting: GAM → click tracker → landing pageTest plan
tests/unit/test_gam_macros.py)🤖 Generated with Claude Code