Jump to content
remy_php

JS - Dynamic display of a zone in the page.

Recommended Posts

Good morning, everyone.

I need to dynamically display a zone in an existing page.

Let me explain:

1 ) The user loads a page from the site.
The zones present with the invocation code are loaded.

2 ) Now, following user actions or other events, I need to display a new advertising zone.  

But inserting the invocation code in the page is not enough...

$('.advertising_slot_result').append('<ins data-revive-zoneid="17" data-revive-id="******************************"></ins>');

How to do this?

Obviously, I want the display and click count on this new area to be operational...

Edited by remy_php
add exemple

Share this post


Link to post
Share on other sites

Bonjour,

I propose the following solution .

1) Use the invocation code at site level

https://documentation.revive-adserver.com/display/DOCS/Invocation+Code:+Website+Level

<head>
    <!-- ... -->
    <script type='text/javascript' src='http://revive.lxc/revive/www/delivery/spcjs.php?id=1'></script>
</head>

2) This gives the possibility to use the OA_show(zone_id) function to invoke the zones


    function OA_show(name) {
        if (typeof(OA_output[name]) == 'undefined') {
            return;
        } else {
            document.write(OA_output[name]);
        }
    }

But we're not going to use it!

What interests us here is the OA_output

3) We write a small function that will retrieve the html code in OA_output and insert it neatly into our page at the desired location.

MY_REVIVE.show = function($parent, zone_id) {
    $parent.append(EDB_REVIVE.getHtml(zone_id));
};

MY_REVIVE.getHtml = function(zone_id) {
    var output = OA_output;
    if (typeof(output[zone_id]) === 'undefined') {
        console.error("Zone " + zone_id + " n'existe pas.");
        return '';
    } else {
        return output[zone_id];
    }
};

Example of use:

MY_REVIVE.show($('#add_slot'), 15);

 

What do you think of that?

 

 

Edited by remy_php

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...