...
Code Block |
---|
const MyPage = () => { // the useEffect hook of functional React is equivalent to componentDidMount of class-based React useEffect(() => { if (window.adngin && window.adngin.adnginLoaderReady) { // when adnginLoaderReady boolean is true, it is safe to access command queues like adngin.queue or googletag.queue adngin.queue.push(() => { // it is recommended to auction only ONCE, so please gather all required ad unit names; // or do not pass anything if all ad units are to be re-auctioned const units = getAdUnitNamesForCurrentPage()["adUnit1", "adUnit3"]; adngin.cmd.startAuction(units); }); }); }); }; |
...