-
Notifications
You must be signed in to change notification settings - Fork 0
Single page apps
John Paul Barbagallo edited this page Jun 23, 2016
·
6 revisions
In a standard implementation, Yieldmo ad placements are meant to be used once per hard page refresh. For those publishers using a Single Page App style implementation (no hard refresh used to show new content), Yieldmo has devised a public API method to request new ads for placements that are already on the page.
For a sample single-page app using Yieldmo placements, visit our test page here (be sure to emulate a mobile device).
Implementation on SPA sites is relatively straightforward. The steps are:
- Implement the placement as a regular, code-on-page unit
- Now that you've loaded in the JS SDK and have
divcontainers (placements) on the page with ads, you may request as many more "pageviews" as desired by invoking the following public method in your javascript code:
// Where '12345678901' and '987654321098' are your placement IDs
window._ym.requestPageView(['12345678901', '987654321098']);- It is a best practice to leave the
window._ymobject unaltered, after it is loaded. Removing, deleting or modifying it in any way from the window object may result in unexpected behavior. Removing it will also break your ability to use therequestPageViewAPI method. - Be mindful of calling this public method as doing so generates a brand new pageview each and every time. To ensure that this is working, please look for network requests going out to the
ads.yieldmo.comendpoint.
After implementation, please sync up with your operations contact at Yieldmo so they may finalize the QA and launch process.