Jump to content
Josh

How to refresh async javascript tags

Recommended Posts

Revive 4.1 added custom events for refreshing.

From release notes: Added custom events to the Javascript Async delivery, allowing the website
to better interact with Revive Adserver, e.g. to refresh some ad placements.

Any usage examples of how to use?

Share this post


Link to post
Share on other sites

Usage example for refreshing javascript async invocation tags.

Got it working like so

HTML

    <div class="ad-300x250" id="ad-300x250-1">
        <ins data-revive-zoneid="153" data-revive-id="b7c2bd3ff3b3bed3a9daa932a43cc2a8"></ins>
        <script async src="https://ra.example.com/www/delivery/asyncjs.php"></script>
    </div>

    <div class="ad-300x250" id="ad-300x250-2">
        <ins data-revive-zoneid="154" data-revive-id="b7c2bd3ff3b3bed3a9daa932a43cc2a8"></ins>
        <script async src="https://ra.example.com/www/delivery/asyncjs.php"></script>
    </div>

JS

    // placements to refresh
    var adSlots = ['#ad-300x250-1', '#ad-300x250-2'];

    // remove data-revive-loaded attribute
    for (var i = adSlots.length - 1; i >= 0; i--) {
        $(adSlots).find('ins').removeAttr('data-revive-loaded');
    }

    // refresh the ads (use your data-revive-id)
    reviveAsync.b7c2bd3ff3b3bed3a9daa932a43cc2a8.refresh();

    // if your data-revive-id starts with number, access like so
    //reviveAsync['7bc2bd3ff3b3bed3a9daa932a43cc2a8'].refresh();

Share this post


Link to post
Share on other sites
On 5/31/2019 at 9:03 PM, Nidhi said:

What is reviveAsync?

I got this error reviveAsync is not defined

I would recommend starting a new thread, with some details of your error, what you were doing at the time you got the error, etc.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...