This event type is raised by the ad as a notification when the ad state changes and when
users interact with the ad. For example, when the ad starts playing, is clicked on, and
more. You can register for the various state changed events on AdsManager.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-26 UTC."],[[["\u003cp\u003eThis document describes the \u003ccode\u003eAdEvent\u003c/code\u003e type, which is triggered when an ad's state changes or when users interact with it, extending from the \u003ccode\u003eImaEvent\u003c/code\u003e type.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAdEvent\u003c/code\u003e object includes properties \u003ccode\u003ecurrentTarget\u003c/code\u003e, \u003ccode\u003etarget\u003c/code\u003e, and \u003ccode\u003etype\u003c/code\u003e, all of which are inherited from \u003ccode\u003eImaEvent\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetAd\u003c/code\u003e method allows you to retrieve the currently playing or recently played ad, while the \u003ccode\u003egetAdData\u003c/code\u003e method enables the retrieval of additional data passed from the ad.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003epreventDefault\u003c/code\u003e and \u003ccode\u003estopPropagation\u003c/code\u003e methods are inherited from \u003ccode\u003eImaEvent\u003c/code\u003e to control the event flow.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetAdData\u003c/code\u003e method is exemplified in a code snippet that checks for log events of type \u003ccode\u003eAdEvent\u003c/code\u003e for error handling.\u003c/p\u003e\n"]]],[],null,["# Interface AdEvent\n\n| **Note:** This reference page follows TypeScript documentation structure. If you have suggestions for or see issues with the reference documentation, open a thread with your feedback on the [IMA technical forum](https://groups.google.com/g/ima-sdk/).\n\n*** ** * ** ***\n\nsubdirectory_arrow_rightExtends [ImaEvent](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.ImaEvent) \nThis event type is raised by the ad as a notification when the ad state changes and when users interact with the ad. For example, when the ad starts playing, is clicked on, and more. You can register for the various state changed events on AdsManager.\n\n| Properties ||\n|----------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [currentTarget?](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdEvent#google.ima.AdEvent.currentTarget) | **Deprecated.** ###### Inherited from [ImaEvent.currentTarget](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.ImaEvent#google.ima.ImaEvent.currentTarget) |\n| [target?](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdEvent#google.ima.AdEvent.target) | The object on which the event was raised (and to which a listener was added). ###### Inherited from [ImaEvent.target](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.ImaEvent#google.ima.ImaEvent.target) |\n| [type](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdEvent#google.ima.AdEvent.type) | ###### Inherited from [ImaEvent.type](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.ImaEvent#google.ima.ImaEvent.type) |\n\n| Methods ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [getAd](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdEvent#google.ima.AdEvent.getAd) | Get the current ad that is playing or just played. |\n| [getAdData](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdEvent#google.ima.AdEvent.getAdData) | Allows extra data to be passed from the ad. |\n| [preventDefault](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdEvent#google.ima.AdEvent.preventDefault) | **Deprecated.** ###### Inherited from [ImaEvent.preventDefault](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.ImaEvent#google.ima.ImaEvent.preventDefault) |\n\nProperties\n----------\n\n*** ** * ** ***\n\n### `Optional`\ncurrentTarget\n\ncurrentTarget?:` `object\n| **Deprecated:** Use `target` instead.\n\n*** ** * ** ***\n\n### `Optional` target\n\ntarget?:` `object The object on which the event was raised (and to which a listener was added).\n\n*** ** * ** ***\n\n### type\n\ntype:` `string\n\nMethods\n-------\n\n*** ** * ** ***\n\n### getAd\n\ngetAd(): [Ad](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad) \nGet the current ad that is playing or just played.\n\n| Returns ||\n|--------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|\n| [Ad](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.Ad) | The ad associated with the event, or null if there is no relevant ad. |\n\n*** ** * ** ***\n\n### getAdData\n\ngetAdData(): object \nAllows extra data to be passed from the ad. \n\nExample: \n\n ` `if (event.type == google.ima.AdEvent.Type.LOG) { let adData = event.getAdData(); if (adData['adError']) { console.log('Non-fatal error occurred: ' + adData['adError'].getMessage()); } } \n\n| Returns ||\n|--------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| object | Extra data for the event. Log events raised for error carry object of type 'google.ima.AdError' which can be accessed using 'adError' key. |\n\n*** ** * ** ***\n\n### preventDefault\n\npreventDefault(): void \n| **Deprecated:** No-op. IMA events do not have a default action."]]