Ima SDK Client Side
GoogleOfficialCreated by Google LLC
- Skill
- Tool integration
- Software development
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The Google IMA SDK client-side skill provides the necessary framework to load and manage in-stream video and audio ads within websites, mobile apps, and TV platforms. It supports VAST and VMAP ad standards, enabling developers to request ads from compliant servers and coordinate playback between ad content and primary media. The skill emphasizes platform-specific implementation patterns for Android, iOS, and web environments, focusing on efficient resource management, proper ad container setup, and lifecycle handling to ensure a seamless user experience.
What it does
- Facilitates client-side ad insertion for video and audio content.
- Supports VAST and VMAP ad standards for ad server communication.
- Provides platform-specific integration guides for Android, iOS, and web.
- Manages ad playback events and content synchronization.
- Includes lifecycle management for SDK initialization, ad requests, and resource cleanup.
When to use it
- When you need to display in-stream video or audio ads on websites, mobile apps, or TV platforms.
- When your ad server provides VAST or VMAP compliant ad tags.
- When you require client-side control over ad playback and ad-to-content transitions.
- When building applications on Android, iOS, or web platforms that require standard ad integration.
Advantages
- Standardized approach to ad insertion across multiple digital platforms.
- Supports industry-standard VAST and VMAP protocols.
- Provides clear lifecycle management to prevent memory leaks and resource issues.
- Enables granular control over ad playback and user experience coordination.
Usage examples
- “How do I initialize the IMA SDK on Android to minimize latency?”
- The SDK recommends calling ImaSdkFactory.initialize() in your Application.onCreate() to preload resources and reusing the same ImaSdkSettings instance across your AdsLoader.
- “What is the correct way to clean up the IMA SDK on iOS?”
- You must call destroy() on the AdsManager when ads complete or errors occur, and release the AdsLoader when the component is permanently destroyed to prevent memory leaks.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/google/ima-sdk-client-side/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip ima-sdk-client-side.zip -d .agents/skills
Documentation by Google LLC
IMA SDK client-side
The Google IMA SDK (Interactive Media Ads) lets you load in-stream video and audio ads into websites, apps, TVs and other digital platforms. Use an IMA SDK to request ads from any VAST-compliant ad server and manage ad playback.
Prerequisites
Before integrating the IMA SDK, you must read the platform-specific guide below to support all platforms that your app can support:
Web/HTML5/ReactJs/NodeJs/Angular: Read all these guides ima-sdk-web-guide.md, ima-sdk-web-iframe-mode.md, ima-sdk-web-mobile-safari.md
Android/AndroidTV/ReactNative: Read ima-sdk-android-guide.md
iOS/tvOS/ReactNative: Read all these guides ima-sdk-ios-guide.md, ima-sdk-tvos-guide.md
Quick start (general workflow)
Import the SDK: Prerequisites, dependencies.
Initialization: Early setup, Warmup, Settings Configuration, and Ad UI Setup.
Ad Request: Creating and triggering the request, User gesture compliance.
Ad Load Success/Failure: Handling the load event to get the AdsManager, or handling early fatal errors.
Ad Playback Events: Listening to playback events via AdsManager to coordinate content play/pause, and handling non-fatal LOG events and fatal active playback errors.
Cleanup: Properly destroying the AdsManager to release resources and prevent memory leaks.
For detailed, platform-specific implementation details, always refer to the guides in the Prerequisites section.
Files
- ATTRIBUTION.mdAdded by AutoGineer920 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md2.1 KiB
- references/ima-sdk-android-guide.md5.5 KiB
- references/ima-sdk-ios-guide.md8.6 KiB
- references/ima-sdk-tvos-guide.md5.9 KiB
- references/ima-sdk-web-guide.md8.3 KiB
- references/ima-sdk-web-iframe-mode.md2.8 KiB
- references/ima-sdk-web-mobile-safari.md514 B
references/ima-sdk-web-iframe-mode.md
IMA SDK HTML5 iframe mode
This guide covers best practices when you can only use the Google IMA SDK for HTML5 within iframes.
Prioritize top page level over iframe
You should try to add the IMA SDK script at the top page level. The page level is preferred over the use of IMA SDK inside an iframe.
Same-origin iframe fallback
If you detect that the IMA SDK script is inside an iframe, ensure that the iframe containing the IMA SDK script, the container page, and the video player all reside on the same domain.
For example: check inside the iframe for access of the top window location.
function hasAccessToTopWindow(): boolean {
try {
// 1. Check if the current context is already the top window.
if (window === window.top) {
return true;
}
// 2. Attempt a same-origin read on the top window location.
// If cross-origin limits apply, this read will throw a DOMException.
const topUrl = window.top.location.href;
return true;
} catch (error) {
// 3. A SecurityError DOMException was thrown.
// When this error happens, the SDK is isolated in a cross-origin iframe
// and does not have direct access to the top-level window.
const errorMessage = error instanceof Error ? error.message : String(error);
console.error("Access to top-level window is blocked: ", errorMessage);
return false;
}
}
if (hasAccessToTopWindow()) {
console.log("IMA SDK has access to the top-level window.");
} else {
console.log("IMA SDK is isolated in a cross-origin iframe sandbox.");
}This same-origin setup is required for the SDK to directly access the
window.top level, the video player element.
Cross-origin iframe workaround
If you detect that the IMA SDK is loaded inside an iframe from a domain
different from the domain of the main page containing the video player, you must
provide the main page's URL to the SDK by setting the adsRequest.pageUrl
property.
Example code:
const adsRequest: google.ima.AdsRequest = new google.ima.AdsRequest();
adsRequest.adTagUrl = 'YOUR_AD_TAG_URL';
// Manually set the page URL to the parent page's URL
adsRequest.pageUrl = 'https://<your_domain>/<path_to_your_page>';Check the sandbox attribute of the iframe loading the IMA SDK to grant these
required capabilities:
Adding
allow-scriptsfor executing the SDK JavaScript. Without this, the IMA SDK fails to load and initializes.Adding
allow-same-originto let the loaded page read its own cookies.Adding
allow-popups,allow-popups-to-escape-sandbox,allow-top-navigation-by-user-activationto let the SDK open the advertiser's landing page.
<iframe sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation" src="PAGE_CONTAINING_IMA_SDK_SCRIPT_TAG">
</iframe>Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Google LLC
- Publisher
- Google (Official)
- Source
- google/skills · skills/ads/ima-sdk-client-side · commit 2194d3b
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google LLC or Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download ima-sdk-client-side.zip