Views

Tổng hợp code Popup quảng cáo cho Blogger/Blogspot

Cập nhật: 10 thg 12, 2018 Lúc 00:47
Bài viết này mình sẽ chia sẻ cho các bạn tổng hợp các code Popup quảng cáo trên Blogspot của mình. Code được mình tổng hợp lại tại nhiều nguồn khác nhau. Mời các bạn cùng tham khảo nhé!
Tổng hợp code Popup quảng cáo cho Blogger/Blogspot

1. CODE POPUP XUẤT HIỆN NHIỀU TAB MỖI KHI CLICK CHUỘT

Thay <body> thành
<body onclick='open_popup()'>
<script type='text/javascript'>
/* <![CDATA[ */
function open_popup() {
window.open("https://www.duyblogs.com/")
window.open("https://www.duyblogs.com/")
window.open("https://www.duyblogs.com/")
}
/* ]]> */
</script>
Mặc định là mở 3 trang Popup, các bạn có thể thêm hoặc bớt với đoạn code window.open("địa_chỉ_web")
Khuyến cáo: cách này sẽ gây khó chịu cho người dùng

2. CODE POPUP-UNDER HIỆN SAU TRÌNH DUYỆT CHO BLOG/WEB

Đặc điểm:
- Các popup-under sẽ tự động xuất hiện mà không cần phải đợi độc giả click vào một vị trí bất kỳ trên trang của bạn.
- Popup sẽ không xuất hiện trên các trình duyệt sử dụng các add on hay phần mềm chặn popup.

Cách thực hiện:

Thêm 1 trong 2 đoạn code sau vào trước thẻ </head> (Hoặc Vào bố cục (Layout) => Thêm tiện ích (Add a widget) => HTML/Javascript => Dán 1 trong 2 đoạn code sau vào)
Code 1:
<script>
function popup() {
var url = "https://www.duyblogs.com/";
window.open(url);
popWin = window.open(page,'popWin');
popWin.blur();
window.focus();
}
popup();
</script>
Code 2:
<script>
var popunder="https://www.duyblogs.com/"
//specify popunder window features
//set 1 to enable a particular feature, 0 to disable
var winfeatures="width=800,height=510,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0"
//Pop-under only once per browser session? (0=no, 1=yes)
//Specifying 0 will cause popunder to load every time page is loaded
var once_per_session=0
///No editing beyond here required/////
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function loadornot(){
if (get_cookie('popunder')==''){
loadpopunder()
document.cookie="popunder=yes"
}
}
function loadpopunder(){
win2=window.open(popunder,"",winfeatures)
win2.blur()
window.focus()
}
if (once_per_session==0)
loadpopunder()
else
loadornot()
</script>

3. CODE POPUP MỞ TAB MỚI KHI CLICK VÀO VỊ TRÍ BẤT KỲ TRÊN WEB

Thêm đoạn code sau vào trước thẻ </head> (Hoặc Vào bố cục (Layout) => Thêm tiện ích (Add a widget) => HTML/Javascript => Dán đoạn code sau vào)
<script type="text/javascript" language=javascript>
function Set_Cookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime(today.getTime());
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" + escape(value) +
((expires) ? ";expires=" + expires_date.toGMTString() : "") +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
((secure) ? ";secure" : "");
}
function Get_Cookie(name) {
var start = document.cookie.indexOf(name + "=");
var len = start + name.length + 1;
if ((!start) &&
(name != document.cookie.substring(0, name.length))) {
return null;
}
if (start == -1) return null;
var end = document.cookie.indexOf(";", len);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(len, end));
}
function Delete_Cookie(name, path, domain) {
if (Get_Cookie(name)) document.cookie = name + "=" +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
";expires=Mon, 11-November-1989 00:00:01 GMT";
}
function popunder() {
if (Get_Cookie('cucre') == null) {
Set_Cookie('cucre', 'cucre Popunder', '1', '/', '', '');
var url = "https://www.duyblogs.com/";
pop = window.open(url, 'windowcucre');
pop.blur();
window.focus();
}}
function addEvent(obj, eventName, func) {
if (obj.attachEvent) {
obj.attachEvent("on" + eventName, func);
}
else if (obj.addEventListener) {
obj.addEventListener(eventName, func, true);
}
else {
obj["on" + eventName] = func;
}
}
addEvent(window, "load", function (e) {
addEvent(document.body, "click", function (e) {
popunder();
});
});
</script>

4. CODE POPUP MỞ CỬA SỔ QUẢNG CÁO NHỎ DƯỚI GÓC MÀN HÌNH

Đặc điểm:
- Xuất hiện 1 lần khi mở trang Web.
- Cửa sổ trang Website được Pop nhỏ ở góc màn hình => kéo dài thời gian ở lại của Website được Pop.

Cách thực hiện:

Thêm đoạn code sau vào trước thẻ </head> (Hoặc Vào bố cục (Layout) => Thêm tiện ích (Add a widget) => HTML/Javascript => Dán đoạn code sau vào)
<script>
function addEvent(obj,eventName,func){if(obj.attachEvent){obj.attachEvent("on"+eventName,func);}else if(obj.addEventListener){obj.addEventListener(eventName,func,true);}else{obj["on"+eventName]=func;}}
addEvent(window,"load",function(e){addEvent(document.body,"click",function(e){var pX;pX=screen.width;if(!pX){pX=document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth;}
if(pX>800){if(document.cookie.indexOf("pnpopup=popactive")==-1){document.cookie='pnpopup=popactive';params='width=50';params+=', height=50';params+=', top=1650, left=1460, resizable=no, scrollbars=yes, location=yes';var w=window.open("https://www.duyblogs.com/",'window1',params).blur();window.focus();}}});});</script>

5. CODE POPUP: XUẤT HIỆN POPUP KHI CLICK CHUỘT LẦN ĐẦU TIÊN

Đặc điểm:
- Cửa sổ Popup chỉ mở ra khi bạn click chuột lần đầu tiên khi truy cập một blog, các thao tác click về sau cửa sổ popup sẽ khi còn xuất hiện. Code này sẽ lấy ngẫu nhiên trang web/blog trong urllist để xuất hiện.

Cách thực hiện:

Thay <body> thành
<body onclick="vtlai_popup();">
<script language="javascript">
/* <![CDATA[ */
var sinhvienit=0;
function SVIT_ADS_GetCookie(Name){
var re=new RegExp(Name+"=[^;]+", "i");
if (document.cookie.match(re))
return decodeURIComponent(document.cookie.match(re)[0].split("=")[1]);
return ""
}
function SVIT_ADS_SetCookie(name, value, days){
if (typeof days!="undefined"){
var expireDate = new Date()
var expstring=expireDate.setDate(expireDate.getDate()+days)
document.cookie = name+"="+decodeURIComponent(value)+"; expires="+expireDate.toGMTString()
}
else document.cookie = name+"="+decodeURIComponent(value);
}
function vtlai_popup()
{
var cookie_popup_ads = SVIT_ADS_GetCookie('sinhvienit_popup_ads');
if (cookie_popup_ads=='') {
if(sinhvienit==0)
{
sinhvienit=1;
var Time_expires = 24 * 3600 * 1000;
SVIT_ADS_SetCookie('sinhvienit_popup_ads','true',Time_expires);
var urllist = ['https://www.duyblogs.com/','https://www.duyblogs.com/','https://www.duyblogs.com/'];
var url = urllist[Math.floor(Math.random() * urllist.length)];
var params = 'width=' + '300';
params += ', height=' + '300';
params += ', top=0,left=0,scrollbars=yes,status=1,toolbar=1,menubar=1,resizable=1,location=1,directories=1';
var pop_ads_open = window.open(url, 'sinhvienit_ads_pop', params);
}
}
}
/* ]]> */
</script>

6. CODE POPUP : XUẤT HIỆN NHIỀU CỬA SỔ KHI CLICK LẦN ĐẦU TIÊN

Đặc điểm:
- Khi click vào blog lần đầu tiên tất cả các cửa sổ đều xuất hiện và chỉ 1 lần duy nhất, những cú click tiếp theo trên cùng 1 trình duyệt thì các cửa sổ không xuất hiện trong một khoảng thời gian nhất định.

Cách thực hiện:

Thay <body> thành
<body onclick='vtlai_popup();'>
<script language='javascript'>
//<![CDATA[
var sinhvienit=0;
function SVIT_ADS_GetCookie(Name){
var re=new RegExp(Name+"=[^;]+", "i");
if (document.cookie.match(re))
return decodeURIComponent(document.cookie.match(re)[0].split("=")[1]);
return ""
}
function SVIT_ADS_SetCookie(name, value, days){
if (typeof days!="undefined"){
var expireDate = new Date()
var expstring=expireDate.setDate(expireDate.getDate()+days)
document.cookie = name+"="+decodeURIComponent(value)+"; expires="+expireDate.toGMTString()
}
else document.cookie = name+"="+decodeURIComponent(value);
}
function vtlai_popup()
{
var cookie_popup_ads = SVIT_ADS_GetCookie('sinhvienit_popup_ads');
if (cookie_popup_ads=='') {
if(sinhvienit==0)
{
sinhvienit=1;
var Time_expires = 24 * 3600 * 1000;
SVIT_ADS_SetCookie('sinhvienit_popup_ads','true',Time_expires);
var params = 'width=' + '600';
params += ', height=' + '500';
params += ',scrollbars=yes,status=1,toolbar=1,menubar=1,resizable=1,location=1,directories=1';
var vtlai_popup_0 = window.open('https://www.duyblogs.com/', 'vtlai_popup_0', params +', top=0,left=0');
var vtlai_popup_1 = window.open('https://www.duyblogs.com/', 'vtlai_popup_1', params +', top=0,left=0');
var vtlai_popup_2 = window.open('https://www.duyblogs.com/', 'vtlai_popup_2', params +', top=0,left=0');
var vtlai_popup_3 = window.open('https://www.duyblogs.com/', 'vtlai_popup_3', params +', top=0,left=0');
}
}
}
//]]>
</script>

7. CODE TẠO QUẢNG CÁO POPUP XUẤT HIỆN 1 LẦN/1 NGÀY/1 IP

Thay <body> thành 1 trong 2 đoạn code sau
Code 1:
<body onclick='popunder();'>
<script>
/* <![CDATA[ */
function Set_Cookie(a,b,c,e,f,g){var d=new Date;d.setTime(d.getTime());d=new Date(d.getTime()+c);document.cookie=a+"="+escape(b)+(c?";expires="+d.toGMTString():"")+(e?";path="+e:"")+(f?";domain="+f:"")+(g?";secure":"")}function Get_Cookie(a){var b=document.cookie.indexOf(a+"="),c=b+a.length+1;if(!b&&a!=document.cookie.substring(0,a.length)||-1==b)return null;a=document.cookie.indexOf(";",c);-1==a&&(a=document.cookie.length);return unescape(document.cookie.substring(c,a))} function Delete_Cookie(a,b,c){Get_Cookie(a)&&(document.cookie=a+"="+(b?";path="+b:"")+(c?";domain="+c:"")+";expires=Mon, 11-November-2020 00:00:01 GMT")}
function popunder(){null==Get_Cookie("cucre")&&(Set_Cookie("cucre","cucre Popunder","1","/","",""),
pop=window.open("https://www.duyblogs.com/","windowcucre"),
pop.blur(),window.focus())}function addEvent(a,b,c){a.attachEvent?a.attachEvent("on"+b,c):a.addEventListener?a.addEventListener(b,c,!0):a["on"+b]=c} addEvent(window,"load",function(){addEvent(document.body,"click",function(){popunder()})});
/* ]]> */
</script>
Code 2:
<script>
//<![CDATA[
function Set_Cookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime(today.getTime());
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" + escape(value) +
((expires) ? ";expires=" + expires_date.toGMTString() : "") +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
((secure) ? ";secure" : "");
}
function Get_Cookie(name) {
var start = document.cookie.indexOf(name + "=");
var len = start + name.length + 1;
if ((!start) &&
(name != document.cookie.substring(0, name.length))) {
return null;
}
if (start == -1) return null;
var end = document.cookie.indexOf(";", len);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(len, end));
}
function Delete_Cookie(name, path, domain) {
if (Get_Cookie(name)) document.cookie = name + "=" +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
";expires=Mon, 11-November-1989 00:00:01 GMT";
}
function popunder() {
if (Get_Cookie('cucre') == null) {
Set_Cookie('cucre', 'cucre Popunder', '1', '/', '', '');
var url = "https://www.duyblogs.com/";
pop = window.open(url, 'windowcucre');
pop.blur();
window.focus();
}
}
function addEvent(obj, eventName, func) {
if (obj.attachEvent) {
obj.attachEvent("on" + eventName, func);
}
else if (obj.addEventListener) {
obj.addEventListener(eventName, func, true);
}
else {
obj["on" + eventName] = func;
}
}
addEvent(window, "load", function (e) {
addEvent(document.body, "click", function (e) {
popunder();
});
});
//]]>
</script>
<body onclick='popunder();'>
Bài đăng mới hơn Bài đăng cũ hơn