我正在寻找广告代码,并在第二次访问时投放

时间:2019-05-08 22:30:35

标签: php html cookies

我正在为基于Wordpress的网站使用2个不同的弹出窗口,但是这两个弹出窗口不应同时打开。所以我需要这样的系统;

“ X公司弹出代码”在他首次进入该网站时将起作用。 访客将在2. 3. 4. ...条目处运行“ Y公司弹出代码”。

24小时后,cookie将被删除,X公司的弹出代码将在第一个条目处再次运行。

  1. 公司弹出代码(X公司)

    var username =“” 787“; var tur =“ 4”;
  2. 公司弹出代码(Y公司)

首先,我希望代码1可以工作,而其他访问则要“ 2nd代码”。

不幸的是,这段代码不起作用;

<script language="javascript">  
    if(document.cookie.indexOf('cerrado=false')<0){
        cad=new Date()
        cad.setTime(cad.getTime() + (days*24*60*60*1000)) 
        expira="; expires=" + cad.toGMTString() 
        document.cookie = "cerrado=false" + expira 
    Here you put (X Company) the one that will be shown only once, call your popup here   

<!-- PopCent.net Popunder Code Start -->

<script>
var username= "787";
var tur= "4";
</script>
<script type="text/javascript" src="cdn.popcent.net/k.js"></script>

<!-- PopCent.net Popunder Code End-->
        }

    function readCookie(cookieName){
        var start = document.cookie.indexOf(cookieName);
        if (start == -1){ 
            document.cookie = "cerrado=yes; expires=" + cad.toGMTString() ;
        } else {
      here you put (Y Company) that you will show call the function or what you think
<script type='text/javascript' src='pl14936407.pvclouds.com/a0/63/c0/a063c0b5b83aefbf5e91c5af65545736.js'></script>
        }
    }
    readCookie("cerrado");
    // -->
    </script>

1 个答案:

答案 0 :(得分:-1)

我希望这对您有用。

<script language="javascript">  
    if(document.cookie.indexOf('cerrado=false')<0){
        cad=new Date()
        cad.setTime(cad.getTime() + (days*24*60*60*1000)) 
        expira="; expires=" + cad.toGMTString() 
        document.cookie = "cerrado=false" + expira 
    Here you put (X Company) the one that will be shown only once, call your popup here   
        }

    function readCookie(cookieName){
        var start = document.cookie.indexOf(cookieName);
        if (start == -1){ 
            document.cookie = "cerrado=yes; expires=" + cad.toGMTString() ;
        } else {
      here you put (Y Company) that you will show call the function or what you think
        }
    }
    readCookie("cerrado");
    // -->
    </script>