Hello
We have advertising on an online gaming website (static ads and in-stream videos).
For video ads, we use the IMA SDK HTML5 library. We include the IMA SDK script in DEFER mode:
<script defer="" type="text/javascript" src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
The video ad is shown after the user plays a game, just when decides to return to the main game area (clicks to leave the current page and goes to another URL).
We have been showing advertising for more than a year. Taking a few days' inventory as a sample, which is approximately 40,000 requests to show an in-stream video ad, approximately 50% of the inventory does not show the video ad due to the following error: google object is not defined (window.google object).
As far as I know, this window.google object is created by the ima3.js library.
Assuming that the object was not defined because the ima3.js file was not downloaded, we thought that this high error rate corresponded to users who had ad blockers installed in their browsers. But since we have activated Google AdManager ad blocking recovery messages service, we see that, according to the GAM report, the number of users who have these ad blockers installed is a much lower.
Additionally, after adding some log messages, we have verified that the script is not deleted when this error occurs. If the adblocker was causing the problem, it would removed it.
Also, we have obtained the following information:
When the DOMContentLoaded event is fired, the ima3.js script exists but the google object is not defined.
When the ad request is made, a few minutes later, after the page loads, the ima3.js script exists but the google object is not defined.
Therefore, we do not know the cause of this error, nor, obviously, how to avoid it.
![]() |
IMA SDK Team |
Hi,
Thank you for sending the code snippet.
After looking at the code snippet, I searched for the "Google Object is not defined" and could not find any results related to the mentioned error in the Google Advanced example. This error might be your log message to understand. However, It would help us to investigate in detail and find the root cause of the issue and make some progress if a minimal sample project is provided from your end. I'm afraid that we'll need detailed debug information from a sample project where it's observed to make any progress in diagnosing this. The only way for us to investigate further is by creating a project where the issue is reproducible.
You can provide the following details via reply privately to the author option or directly provide it to the link below.
If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:
1. Navigate to
https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=IMA+SDK&entry.460850823=5004Q00002tJSljQAG&entry.80707362=002437822. Fill out all fields, and attach your file(s).
3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link.