HTML5 SDK > How to execute javascript when serving AdTag

97 views
Skip to first unread message

Tharles - Ha Nguyen

unread,
Apr 9, 2020, 3:55:22 AM4/9/20
to Interactive Media Ads SDK
How to execute javascript which is returned from API. 

What we have:
- Vast file with XML format of Media Ads for HTML5.
- One API with Javascript response. 
- Tried to use "AdVerifications > Verification > JavaScriptResource" tag but can't trigger to execute
Expected: 
- Since AdTag is served or whenever Vast file is called, it will trigger to execute Javascript which is responded from API below
- Provide tag to apply this scenario. 

Thanks & waiting !! 


This is API "/vast/serving/js" with js response. 
The purpose is to generate Fingerprint, store at Local Storage of client side and re-execute API twice with value Fingerprint on query param such as "/vast/serving/js?fingerprint=[xyz]". 
```
var isStorage; function generateFingerprintAndScript(adservingUrl) { var generateFingerprint = function() { Fingerprint2.get(function(components) { console.log(components); var values = components.map(function(component) { return component.value }); var murmur = Fingerprint2.x64hash128(values.join(''), 31); console.log(murmur); if (isStorage) { localStorage.setItem("murmur", murmur); } generateScript(adservingUrl, murmur); }); }; var script = document.createElement('script'); script.onload = function() { if (window.requestIdleCallback) { requestIdleCallback(function() { generateFingerprint(); }) } else { setTimeout(function() { generateFingerprint(); }, 500) } } ; script.src = "......./sv/js/fingerprint2.min.js"; document.head.appendChild(script); } function generateScript(adservingUrl, murmur) { let itp = true; if (adservingUrl.includes('/r') || adservingUrl.includes('/tr/clickthrough')) { window.location.replace(adservingUrl + "&bf=" + murmur + "&itp=" + itp); } else { var scriptElement = document.createElement('script'); scriptElement.src = encodeURI(adservingUrl + "&bf=" + murmur + "&itp=" + itp); document.body.appendChild(scriptElement); } } function generateAd(adUrl) { if (typeof (Storage) !== "undefined") { isStorage = true; if (localStorage.getItem("murmur")) { generateScript(adUrl, localStorage.getItem("murmur")); } else { generateFingerprintAndScript(adUrl); } } else { isStorage = false; generateFingerprintAndScript(adUrl); } } document.addEventListener('DOMContentLoaded', function() { console.log("current location:", window.location.href); generateAd(window.location.href); });
```


IMA SDK

unread,
Apr 9, 2020, 3:37:34 PM4/9/20
to trungh...@gmail.com, ima...@googlegroups.com
Hi Tharles,

Thank you for reaching out to us. The AdVerifications element of the VAST XML is generally used by the OMID SDK to verify and report the ad's viewability. We're currently waiting on the OMID SDK Team to launch support for the IMA SDK HTML5 platform so we can provide support the JavascriptResources of the AdVerifications element. I cannot guarantee if and when this would be made available by the OMID SDK Team.
In the meantime, you may continue to follow our release history and our blog for updates regarding this feature.

Regards,
Arnaud Casame
IMA SDK Team


ref:_00D1U1174p._5001UZX31i:ref

Tharles - Ha Nguyen

unread,
Apr 10, 2020, 12:39:37 AM4/10/20
to Interactive Media Ads SDK
Hi Arnaud Casame, 

Thanks for your feedback. 
If forget "AdVerifications" tag, can you guide any way to execute "javascript code" when the AdTag is served?

Regard

IMA SDK

unread,
Apr 10, 2020, 3:27:34 PM4/10/20
to trungh...@gmail.com, ima...@googlegroups.com
Hi Tharles,

There's currently no way for you to execute the Javascript code when the VAST XML is served, this feature will be supported once the OMID SDK for HTML5 is released by the OMID SDK Team.


Regards,
Arnaud Casame
IMA SDK Team


ref:_00D1U1174p._5001UZX31i:ref

Nguyen Trung Ha

unread,
Apr 13, 2020, 3:26:48 AM4/13/20
to IMA SDK, ima...@googlegroups.com
Hi Arnaud Casame, 
Would you mind proposing time to leave this feature of OMID SDK Team? So that we can re-update plan
Thanks in advance

Regards, 

IMA SDK

unread,
Apr 13, 2020, 6:26:43 AM4/13/20
to trungh...@gmail.com, ima...@googlegroups.com

Hi Tharles,

Thank you for your response.

With regard to your concern about OMID SDK support for HTML5. I'm afraid we cannot give you an exact time on when this feature would be made available. In the meantime, you may continue to follow our release history and our blog for updates regarding this feature.

Regards,
Sherwin Diesta
IMA SDK Team



ref:_00D1U1174p._5001UZX31i:ref

Nguyen Trung Ha

unread,
May 7, 2020, 6:39:59 AM5/7/20
to IMA SDK, ima...@googlegroups.com
HI IMA SDK Team, 
It has been 4 weeks since last confirm about OMID SDK status, for executing Javascript code when Vast XML is served. 
Does that feature release yet? 

Waiting for feedback. 

Regards, 

IMA SDK

unread,
May 7, 2020, 2:50:54 PM5/7/20
to trungh...@gmail.com, ima...@googlegroups.com
Hi Tharles,

Executing Javascript through AdVerifications element is currently not feasible, there is currently no OMID SDK - HTML5 support. The OMID SDK team must release support for HTML5 platforms so we can provide support for Javascript execution through AdVerifications element.

Regards,
Arnaud Casame
IMA SDK Team


ref:_00D1U1174p._5001UZX31i:ref

Nguyen Trung Ha

unread,
May 11, 2020, 4:58:14 AM5/11/20
to IMA SDK, ima...@googlegroups.com
Thanks Arnaud Casame, 
No choice now, needing to wait until having launching version from OMID SDK. 
In the meantimes, if have any way to trigger JS script for HTML5 platform, please update to me earlier. 

Regards, 

IMA SDK

unread,
May 11, 2020, 7:22:17 AM5/11/20
to trungh...@gmail.com, ima...@googlegroups.com

Hi there,

Thank you for your response. You might want to consider using a VPAID 2 creative instead. You can check out the below link to learn more about how to enable VPAID 2 JavaScript support for the IMA SDK for HTML5.

https://developers.google.com/interactive-media-ads/docs/sdks/html5/vpaid2js

Let me know if this works for you.

Regards,
Sherwin Diesta
IMA SDK Team



ref:_00D1U1174p._5001UZX31i:ref
Reply all
Reply to author
Forward
0 new messages