Site icon HTML5chat, free html5 video chat

How to insert ad into chat ?

ad

ad

There are many ways to insert ads into chat. This is especially easy when you know some JS.

Remember: you can your OWN javascript into the chat.

If you want to insert ads inside the text chat, then you should use the news managements.

If you want some visual ad, there is a <div id=”ad”></div> present on the chat (on top right) when you can insert your ads. The best way to do that is also to insert your OWN javascript into the chat and with some code display the ads.

Here is a sample of how to randomly display 3 ads every 30 seconds:

$(document).ready(function () {
// list of ads !
let ads = [
"<a href='https://www.yoursite.com' target='_blank'><img src='https://www.yoursite.com/img/ad1.png'></a>",
"<a href='https://www.yoursite.com' target='_blank'><img src='https://www.yoursite.com/img/ad2.png'></a>",
"<a href='https://www.yoursite.com' target='_blank'><img src='https://www.yoursite.com/img/ad3.png'></a>",
];
setTimeout(function() {
let ad = randomAd = ads[Math.floor(Math.random() * ads.length)]; // pick a random ad
$('#ad').empty().append(ad);

} , 30 *1000); // loop every 30 seconds
});
Exit mobile version