Pop Up code that opens once

The coding language is JS, guys. It opens the relevant page in the bottom right. It doesn’t attract attention when the pop-up opens. Therefore, it generally doesn’t reduce time on page. I tested it, and it doesn’t have a negative effect on SEO. It would be fair to say it even increases time on page. :slight_smile:

<script type="text/javascript">
var puShown = false;
        function doOpen(url)
        {
                if ( puShown == true )
                {
                        return true;
                }
             win = window.open(url,"yenipencere","menubar=0,resizable=1,width=1,height=1");
             win.moveTo(150000, 150000); 
                if ( win )
                {
                        win.blur();
                        puShown = true;
                }
                return win;
        }
        function setCookie(name, value, time)
        {
            var expires = new Date();
            expires.setTime( expires.getTime() + time );
            document.cookie = name + '=' + value + '; expires=' + expires.toGMTString();
        }
       function getCookie(name) { 
var cookies = document.cookie.toString().split('; '); 
var cookie, c_name, c_value; 
// if you set n=1; to 0, the popup connects to cookie management and 
// opens only once. As long as n=1; remains, the popup will open continuously. 
for (var n=0; n<cookies.length; n++) { 
cookie = cookies[n].split('='); 
c_name = cookie[0]; 
c_value = cookie[1]; 
if ( c_name == name ) { 
return c_value; 
                }
            }
            return null;
        }
        function initPu()
        {
                if ( document.attachEvent )
                {
                        document.attachEvent( 'onclick', checkTarget );
                }
                else if ( document.addEventListener )
                {
                        document.addEventListener( 'click', checkTarget, false );
                }
        }
        function checkTarget(e)
        {
            if ( !getCookie('esl') ) {
                var e = e || window.event;
                var win = doOpen('https://community.cryptosam.com/');
                setCookie('esl', 1, 1*60*60*1000);
            }
        }
initPu();
</script>

Merhabalar hocam

Bu kod çalışıyor ama herhangi bir yere click atınca çalışıyor. Direk otomatikmen siteye giren kişide açılması için nasıl bir düzenleme yapmamız lazım… selamlar

I use this code because it is beneficial in terms of SEO. My recommendation is to use this without harming the site, which will have a positive impact on the advertised site. To convert it from the page loading style you mentioned to a normal one, I assume modifications need to be made to the onclick and click parts. If someone knowledgeable comes along, we can benefit as well.

Öncelikle geri dönüşünüz için teşekkür ederim…

onclick ve click kısmını onscroll ve scroll olarak değiştirince mausede aşağı inince otomatik olarak popup açılıyor ama maalesef popup engeline takılıyor.

Direk siteye giren kullanıcıda click veya scroll tanımlaması yapmadan popup kısmını aynı şekilde açtırma şansımız var mı ?

Js de sağlam bir arkadaşa sordum uygun anda çözüm bulursa bu konudan dönecek.

hocam bu kodu 24 saatte bir kez açılacak şekilde ayarlayabilir miyiz

setCookie('esl', 1, 1*60*60*1000);

If it stays at 1 there, it opens every hour.

setCookie('esl', 1, 24*60*60*1000);

If you set that to 24, it opens every 24 hours. I took a quick look; I would appreciate it if you could try it and reply to the thread if it is correct. Let’s not mislead others.

Hocam sadece masaüstünde açılsın, mobil de açılmasın bunun için ekleyebileceğimiz bir kod varmı?

I don’t currently have it, sir. Hopefully, someone will edit it.
As for WordPress;

<?php
if ( wp_is_mobile() ) {
	/* Include/display resources targeted to phones/tablets

Hocam wp sitem için popup kodunu eklicem fakat mobilde açılsın istemiyorum sadece masaüstü ve laptoplarda açılsın istiyorum. Aşağıdaki kodu, üstte yazdığınız popup kodunun neresine eklemem gerekiyor kod bilgim olmadığı için anlayamadım

<?php if ( wp_is_mobile() ) { /* Include/display resources targeted to phones/tablets here */ } else { /* Include/display resources targeted to laptops/desktops here */ } ?>
<?php
if ( wp_is_mobile() ) {
	Code to show on phones and tablets goes here
} else {
	Code to show on PC goes here
}
?>

That is what needs to be done.
For instance;

<?php
if ( wp_is_mobile() ) {
	You leave this blank because you won't show it on mobile
} else {
	And here, let's assume you named the file containing the popup code to be shown via JS as pop.js. You call that JS code, and thus you only run that JS code on the PC in the theme.
}
?>

I believe if you modify the example I gave above in the WordPress theme, for example in header.php where the JS code is added, it will work.