Exit API vs clickTag: Google HTML5 ad click paths
Google HTML5 ads never decide their own click destination. Here is how clickTag and the Exit API each hand the click to the platform, and how to pick the right one.
Key takeaways - clickTag is a variable that Google overwrites with the ad's destination URL. It is the standard click path for Display HTML5 ads. - The Exit API is a script supplied by Google plus a function you call when the user taps. It is the click path for HTML5 assets in App campaigns. - Both exist for the same reason: the network, not your creative, decides where a click goes, so it can count and route it. - Mixing the two, or hard-coding a store URL, is a frequent cause of rejected or silently dead HTML5 ads. - Pick the campaign type first, then build one ZIP per click path and test it the way Google will load it.
Why Google HTML5 ads have a special click path
On a normal web page you write a link and the browser follows it. In an ad, that would cause problems. The network needs to measure the click, apply the advertiser's final URL, and sometimes attach tracking parameters. If every creative carried its own hard-coded destination, none of that would be reliable.
So Google asks HTML5 creatives to hand the click to the platform instead of choosing a destination themselves. There are two ways to do it. Which one you use depends on the campaign type, not on preference.
One caution before the details. Exact snippets, file requirements and limits change over time. Treat this article as a map of the concepts, and copy the current code and specs from the Google Ads help center when you build.
How clickTag works
clickTag is the older and better-known pattern. The idea is simple:
- Your HTML declares a JavaScript variable named
clickTag, usually with a placeholder URL. - When Google serves the ad, it replaces that value with the ad's final URL.
- When the user taps, your code opens whatever the variable holds at that moment.
In practice that means a small inline script in the page that sets clickTag to a dummy address, and a click handler on your call-to-action that runs window.open(window.clickTag, "_blank").
The placeholder exists only so the file works when you preview it. In production it is overwritten. If you wonder why the call should happen directly inside the tap handler, the MDN reference for window.open explains how browsers treat pop-ups that are not triggered by a user gesture.
Where clickTag is used
clickTag is the click path for Display HTML5 ads: banners and similar display creatives. Our clickTag for Display checklist covers the details specific to that format.
Common clickTag mistakes
- Wrong spelling or case. The name is case-sensitive.
clicktag,ClickTagandclick_tagare different variables, and the platform will not overwrite them. - Reading the value too early. If you copy
clickTaginto another variable at load time, you capture the placeholder. Read it inside the click handler. - Several click targets with different URLs. A Display ad should send every click to the single destination Google supplies.
- Putting the variable in an external file. Declare it inline in the HTML so validators and the platform can find it.
- Hard-coding the real URL. It passes your local test, then fails review or bypasses tracking.
How the Exit API works
The Exit API flips the model. Instead of reading a variable, your ad includes a script supplied by Google and calls a function when the user should leave the ad. Your code never touches the URL.
The pattern has two parts. First, a script tag in the HTML head that loads Google's Exit API script. Second, a click handler that calls ExitApi.exit() when the user taps the call-to-action.
I am deliberately not pasting the script address here. It is the part most likely to be updated, so copy it from the current Google Ads documentation for HTML5 App campaign assets rather than from a blog post, including this one.
Where the Exit API is used
The Exit API is the click path for HTML5 assets in App campaigns. There, the destination is not a free-form URL. It is the app's store listing, configured on the campaign, and Google handles routing to the App Store or Google Play. That is why your creative has no business knowing the link.
For how the HTML5 asset fits into an App campaign, see ExitApi in App campaigns, which covers the specifics in more depth.
Common Exit API mistakes
- Using clickTag in an App campaign ZIP. The ad loads and looks fine, but the click path the campaign expects is missing.
- Calling
exitbefore the script has loaded. On a slow connection, an early tap can hit an undefined object. Guard the call, or enable the button only once the API exists. - Bundling a local copy of the script. The platform expects its own script, not an imitation.
- Calling
exitfrom many places without thought. Every call leaves the ad. In a playable, fire it only from intentional actions, such as the end-card button.
Exit API vs clickTag side by side
- Mechanism. clickTag is a variable Google overwrites. The Exit API is a script you include and a function you call.
- Who knows the URL. With clickTag, your code reads it and opens it. With the Exit API, your code never sees it.
- Typical campaign type. clickTag is for Display HTML5. The Exit API is for HTML5 assets in App campaigns.
- Typical failure. clickTag breaks on naming and timing. The Exit API breaks on a missing or late script.
- Local testing. clickTag works with a placeholder URL. The Exit API needs a stub, or the real script in Google's environment, to behave as it will in production.
Choosing between them
Do not choose by taste. Work backwards from where the ad will run.
- Name the campaign type. Display campaign with a custom landing page: clickTag. App campaign promoting a store listing: Exit API.
- Read the current requirements for that type. Google's help center is the source of truth for the snippet, the file rules and the allowed formats.
- Build one ZIP per path. A file that tries to support both is harder to validate and harder to debug. Keep separate builds, clearly named.
- Keep the click logic in one place. One function that handles the tap makes it easy to swap the mechanism without touching the rest of the ad.
Playable ads add one wrinkle. The user taps many times during play, but only a few of those taps should leave the ad. Wire the click path to the install or call-to-action button, usually on the end card, and let gameplay taps stay inside the creative. If you are designing that last screen, Playable Ad End Card: Design the Last Moments is a useful companion.
Testing the click path before you upload
A click path that works in your browser tells you very little, because the platform part is missing. Test in layers:
- Static check. Search the final build for the exact variable name or script reference. Typos are easy to make and easy to catch.
- Stub check. For clickTag, set the variable to a test URL and confirm the tap opens it. For the Exit API, use a stub object with an
exitfunction that logs a message, and confirm the tap calls it once. - Platform check. Upload to Google's validation or preview tools and tap through the real ad, on a real device where you can.
- Failure check. Tap before the ad has fully loaded. If the page throws an error, fix it before review does.
If an upload is rejected, the reason often traces back to the click path or to package structure. HTML5 Ad Disapproved in Google Ads: Causes and Fixes lists the usual suspects and how to work through them.
A short note on tooling
If you build playables by hand, keep a tiny checklist for the click path and run it on every export. If you use a tool such as PlayableRun to turn a store listing into a playable, check the exported ZIP the same way, because the destination type still depends on the campaign you upload it to. The test is the same whoever produced the file.
Where to go next
The difference between the two is smaller than it looks: in both, the platform owns the destination and your creative only signals intent. Once that is clear, most click problems come down to naming, timing and using the wrong path for the campaign. If you want to see how finished playables behave, browse the live demos, or create a free account and test an export against your own campaign.
Frequently asked questions
›Can I use clickTag and the Exit API in the same HTML5 file?
It is better not to. Each mechanism targets a different campaign type, and a file that mixes them can confuse validation or leave a click path the campaign does not expect. Build one ZIP per click path.
›Which one do I need for an App campaign?
Google's App campaign HTML5 requirements point to the Exit API. Confirm this in the current Google Ads help center before you build, since requirements are updated over time.
›Why can't I just hard-code my store URL?
The network needs to route and measure the click itself, and App campaigns take the destination from the campaign settings. A hard-coded URL can be rejected in review or bypass the platform's click handling.
›Why does my clickTag ad work locally but not after upload?
Locally, the variable still holds your placeholder URL. In production Google overwrites it. Typical causes are a misspelled variable name, copying the value too early, or declaring it in an external file.
›Will the Exit API work when I open the file in a browser?
Not by itself. The platform script is meant to run in Google's serving environment, so use a stub for local checks and validate the real ZIP with Google's tools.
Sources
Turn your store listing into a playable
Paste an App Store or Google Play link and get an HTML5 playable you can test in minutes. The first one is free.
Keep reading
- Google Ads HTML5
HTML5 Display Ads vs App Campaigns: Different Code
7 min read
- Google Ads HTML5
Google Ads HTML5 Eligibility: Get Your Account Ready
7 min read
- Google Ads HTML5
Self Contained HTML5 Ad: No CDNs, No Web Fonts
8 min read