Learn how to refresh nend ads in Monaca

Asked 2 years ago, Updated 2 years ago, 74 views

Thank you for your help.
I am currently developing a hybrid application at Monaca.
As stated in the title, we introduced nend ads and were able to display them safely.
It was good to get to
As long as the displayed advertisement does not reload the page, no matter how many times it is displayed, the advertisement does not change at all.
If possible, I would like to change it every time I display it, but what should I do?

Currently, we use ons-modal as follows for advertising.
I show the modal when I need it.
Refresh the ad or
at this show timing I would like to refresh myself when I hide it.

<ons-modal var="ad_modal" id="AdModal">
<divid="nend_wrapper">
    <script type="text/javascript" src="https://js1.nend.net/js/nendAdLoader.js">/script>
</div>
<divid="CloseBottonDiv">
    <label class="CloseBotton" onClick="AdModalHide()">Close</label>
</div>
</ons-modal>

Once I removed it from DOM and dynamically created the tag on the JS side, but
I couldn't redisplay it;;;

If anyone knows, please take care of me...

monaca nend

2022-09-30 11:53

2 Answers

Inserting a script tag after displaying it in angularjs does not work, so it is solved by inserting a new nend script using angular-loadscript.js.


2022-09-30 11:53

It's a problem on the nend side, so it's quite difficult, but after a quick look at the nend script, it seems to refresh with nendCommon.init().If you want to refresh the dialog when you open it,

nendCommon.init();
modal.show();

What do you think of course.
(nendCommon is defined in https://js1.nend.net/js/nendAdLoader.js)
 However, I don't know if I can use this method in the future because it doesn't seem to be a public calling method.

[Additional note]
nendCommon.init() was not a refresh, but an initialization process.
Also, as Mr. oTak said in the comment, this alone will increase the number of unnecessary script tags, so we need to implement it to delete them.


2022-09-30 11:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.