GAM module, gam testing endpoints, working locally #23
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.
New functionality to call GAM server side accomplishing the following:
... we aren't trying to render yet
More context and details:
The response is multi-part, with a JSON metadata header for each ad slot followed by a full HTML payload.
For each ad request, we get a JSON array that contains critical metadata.
Important components would be:
"/37xx/trustedserver/homepage": The ad unit this response is for.
"html": The format of the creative.
90, 728: The ad's height and width (needed for rendering)
[138210129xxx]: The Creative ID.
[4410806xxx]: The Line Item ID.
The core of the response is a full <!doctype html>... document. This document should have everything needed for the ad to function in a sandboxed environment:
The creative asset itself: An
tag pointing to a tpc.googlesyndication.com URL.
The click-through URL: The tag's href points to a googleads.g.doubleclick.net/pcs/click tracker.
The payload is a full HTML document, implicitly telling us: "You must render this inside an iframe."
Simply injecting this HTML into our main page would break the DOM. The iframe is necessary to isolate the ad's environment from the publisher's page.
Inside the creative's HTML, there is a critical JavaScript call: vu("https://securepubads.g.doubleclick.net/pcs/view?xai=...").
This vu() (View URL) function fires the impression tracking pixel. This is a mandatory action. We cannot consider the ad delivered until this URL has been requested.