Email ad codes on a site
Put ads in a newsletter with the script-free email tag — what the generated image-plus-link markup contains, the rand value that keeps impression and click on the same creative, how it counts — and mail any placement's tags to the people who paste them with the site's Email ad tags dialog, with the caveats and a fix-it checklist.
What it is and why
Email inventory cannot run scripts, so its ad code is the simplest tag the platform generates: a click link wrapping an image. The image request picks the banner and counts the impression; the link counts the click and lands on the same banner’s page. This page covers what that markup contains and how it tracks, plus the site-level Email ad tags dialog — the tool that mails any placement’s tags (email or otherwise) straight to the people who will paste them.
Example. A newsletter with 20,000 subscribers carries one Email placement. The sending
platform replaces rand=<SET_UNIQUE_AD_ID_HERE> with its message id, so each of the 20,000 mails
has its own value. 8,000 readers open the mail: 8,000 image fetches, 8,000 CPM impressions, each
remembering “this message → banner X” for 24 hours. 240 of them click; every click resolves to
the banner that reader actually saw. Leave the placeholder in and all 240 clicks resolve against
whichever banner was cached last.
Typical scenarios
| You want | Do | Where |
|---|---|---|
| Ads in a newsletter sent from a mailing platform | Copy the Email tab’s snippet and replace <SET_UNIQUE_AD_ID_HERE> with the platform’s per-message merge tag, in both URLs | Placement → Ad tags & API → Email |
| Build the mail yourself from two URLs | Use the read-only Creative URL (the image) and Landing page URL (the click), same rand on both | Under the snippet on the same tab |
| Send a site owner every tag they need in one mail | Actions → Email ad tags, tick the placements, Send | The site editor header |
One .txt per placement and tag type instead of one file | Turn Send as a single file off | The mailing dialog |
| A custom covering text | Open More details and edit Subject / HTML Body before Send | The mailing dialog |
| Mail tags from a script | POST /rest-api/sites/{siteId}/invocation-codes/send.do | See Over the API |
Step by step
Copy the email code for a newsletter
-
Open the saved Email placement (create one) and its Ad tags & API → Email tab. It generates exactly this markup, with your domain and key:
<a href='https://<ad-serving-domain>/admlclck?key=<placement-key>&rand=<SET_UNIQUE_AD_ID_HERE>'> <img src='https://<ad-serving-domain>/adml?key=<placement-key>&rand=<SET_UNIQUE_AD_ID_HERE>'/> </a>
-
Replace
rand=<SET_UNIQUE_AD_ID_HERE>with a value unique per sent email — a merge tag or message id from your sending platform. Both URLs must carry the same value within one email. The same two URLs are also available separately as the read-only Creative URL and Landing page URL fields directly under the code block. -
Paste the snippet into the newsletter template and send a test to yourself: the image should show a creative, and the link should land on that creative’s page.
Mail tags from the site: Email ad tags
The site editor’s header Actions → Email ad tags opens a mailing dialog that covers all the site’s placements, not just email ones:
-
Open Account → Publishers → site → Actions → Email ad tags. The dialog is titled Ad tag mailing settings, and the grid’s first column is headed Publisher/Zone/Placement.

-
The dialog shows the site’s zone → placement tree as a grid: one row per placement, one checkbox column per tag type. A checkbox renders only where the tag type applies to that placement’s type, and each placement’s default tag type comes pre-checked. Select all / Deselect all work across the whole tree.
-
Fill the mailing fields: Emails(comma separated) (pre-filled with the site’s contact email, or the site owners’ emails when it has none). From is read-only: the mail always goes out from your own account’s address. Under More details, Subject and HTML Body arrive pre-filled from the Send invocation code template; edit them to send something custom.
-
Choose the packaging: with Send as a single file on (the default) all selected codes go into one
.txtattachment separated by per-placement comment headers; off, each placement×tag-type pair becomes its own.txtattachment. -
Click Send. Each recipient gets their own email built from the network’s Send invocation code template.
Caveats and exceptions
Who can do this. Reading a tag from the placement editor needs only view access on the site — a publisher copies the email code from the placement’s Email tab, and a Can View share keeps the tab and its URLs copyable. The site-level mailing dialog needs the Email Invocation Codes permission, an editable site, and a network that has the Send invocation code email template — without the template the Actions entry does not exist at all, for anyone. The administrator configures that template. Exact grants: User roles.
What the two URLs do. The <img> is the impression request: when the mail client
fetches it, the ad server picks a banner for the placement, logs a CPM impression and redirects
to the creative’s image file. If nothing is eligible to serve, it returns a transparent 1×1 PNG so
the email never shows a broken image. The <a> is the click link: it logs the click and
redirects to the click-through URL of the same banner the image showed.
How impression and click stay in sync. The rand value is the glue: on the image fetch the
server remembers “placement + this rand → banner X” for 24 hours; the click with the same
rand looks that pairing up and redirects to banner X’s landing page. Without it, the click would
re-run banner selection and could send the reader to a different advertiser than the one whose
creative they saw. A reader who opens the email today and clicks next week triggers a fresh
lookup: the click cannot resolve the shown banner and the link goes nowhere. Reopening the email
(re-fetching the image) refreshes the pairing.
Leave the placeholder in and attribution breaks. If <SET_UNIQUE_AD_ID_HERE> stays literally
in the sent email, every recipient shares one pairing key — the first image fetch fixes the
banner, and everyone’s clicks resolve against whatever banner was cached last. Stats still
count, but click attribution across recipients becomes meaningless.
The serving domain comes from the placement’s Domain selection (falling back to the
network’s default tag domain, and to the system default ad-serving domain only on a network with
no tag domain configured) and is always https. The markup uses the short /adml and
/admlclck paths — the legacy aliases of /ads-mail and /ads-mail-click — and both stay
mapped precisely because emails already sent can never be updated. The same logic applies to the
domain: never retire a domain used in sent newsletters.
Default parameters travel with the snippet. It carries a $allDefaultUrlParams token on
both URLs, right after the rand value, which resolves to whatever default tag parameters
the placement carries (channel, custom parameters, click, the pass-through privacy signals from
the Settings tab) — empty on a fresh placement, not empty the moment someone adds a default.
If you keep a copy of the tag somewhere, re-copy it after changing those defaults.
Sending with nothing ticked “succeeds” and mails nothing. The dialog only validates the From and recipient addresses, and the server only does any work when the selection is non-empty — so the dialog closes on a success that never produced an email.
The send is permission-filtered per tag type on the server. A tag type you ticked but have no permission for is silently skipped from the sent mail — no error, the email just lacks that attachment or section. Deleted placements are skipped the same way.
Every ticked placement must be on a site you can view. If one is not, nothing is sent at all and the dialog reports a permission error — the check is not per placement.
Not working?
| Symptom | Check | Where |
|---|---|---|
| Clicks land on a different advertiser than the one shown | <SET_UNIQUE_AD_ID_HERE> was left in, or the two URLs carry different rand values | The sent mail’s source — one merge tag, on both URLs |
| A click goes nowhere | More than 24 hours passed since the last image fetch, so the pairing expired | Reopen the mail (re-fetch the image), then click |
| The image is a blank 1×1 | Nothing was eligible to serve — no linked banner, targeting, capping or limits | The placement’s Linked banners; My ad is not serving |
| Custom parameters or channel missing from the requests | The snippet was copied before the defaults were added | Re-copy it from the Email tab |
| No Email ad tags entry under Actions | The network has no Send invocation code email template (a configuration, not a permission), the site is not editable, or your role lacks Email Invocation Codes | Admin: the email templates first, then Roles |
| The dialog closed but no mail arrived | Nothing was ticked | Tick at least one checkbox before Send |
| The mail lacks an attachment or section | Your role lacks the permission for that tag type, or the placement was deleted | Roles, per tag type |
| The dialog reports a permission error and sends nothing | One ticked placement is on a site you cannot view | Untick it, or get view access to that site |
The API answers 400 on send | A placement of another site or a tag type you cannot generate was passed, or the network has no template and subject / body were not both sent | The request parameters |
Reference
| Item | Value |
|---|---|
| Image (impression) URL | https://<ad-serving-domain>/adml?key=<placement-key>&rand=<unique> — alias of /ads-mail; a transparent 1×1 PNG when nothing serves |
| Click URL | https://<ad-serving-domain>/admlclck?key=<placement-key>&rand=<unique> — alias of /ads-mail-click |
rand | A value unique per sent email, identical on both URLs; the impression→click pairing lives 24 hours after the last image fetch |
| Fields under the snippet | Creative URL, Landing page URL (read-only, Email tab) |
| Mailing dialog | Ad tag mailing settings: grid Publisher/Zone/Placement × tag types; Emails(comma separated); From read-only; More details → Subject, HTML Body; Send as a single file (default on) |
| Permissions | Email Invocation Codes + an editable site + the Send invocation code template (dialog); view access on the site (Email tab, API) |
Over the API
The same listing and mailing are available under /rest-api; both need view access to the site
(all inventory, or a share on this site).
GET /rest-api/sites/{siteId}/invocation-codes.dolists the site’s live placements, zone by zone:{success, total, data: [{zoneId, zoneName, placementId, placementName, placementType, codeTypes}]}.codeTypesis what you may generate for that placement — the tag types its placement type offers, minus those your role lacks the per-type permission for. Page withstart(default 0) andlimit(1–1000, default 50). A deleted or missing site is404.POST /rest-api/sites/{siteId}/invocation-codes/send.domails them. Parameters:emails(repeat it, 1–20 addresses),placementInvocationCodes[<placementId>](the tag types to send for that placement, e.g.placementInvocationCodes[4001]=AJAX,DIRECT_URL), and optionallysubject,body,singleFile(defaulttrue) andbccAuthor. The response is{success, recipients}.
The API is stricter than the dialog about what it will send: a placement of another site or a
tag type you cannot generate is a 400 rather than a silent skip, and a missing or deleted
placement is a 404. On a network with a Send invocation code template, subject and body
replace the template’s own. A network with no such template still mails the codes when the call
sends both subject and body — a plain message with the codes attached; without them it
answers 400, where the dialog simply is not offered. There is no from parameter — like the
dialog, the mail always goes out from the calling user’s address. Each send is recorded in the
action log.