How do I use javascript cookie to control the popup once per user visit?

4 replies
Hi warriors,

I was given a js code to show the popup, I inserted it into my site template, and it get loaded every time user load a new page, eventhough he click on the close button, it keep loaded every new page load, this wil get very annoyed.

The code was given to me as follow:

<script type="text/javascript" src="http://wildfireapp.com/website/302/companies/124704/widget_loader.js"></script>

I'm not a programmer, and can't figure up how to write a cookie to control this popup. I have tried to google, got some sample, but don't know how to integrate and change them to work for me. I appreciate if you can help or show me some guidance. Thank you very much in advanced.

Regards,
Lester
#control #cookie #javascript #popup #user #visit
  • Profile picture of the author SpamHat
    Originally Posted by ycsim4016 View Post

    Hi warriors,

    I was given a js code to show the popup, I inserted it into my site template, and it get loaded every time user load a new page, eventhough he click on the close button, it keep loaded every new page load, this wil get very annoyed.

    The code was given to me as follow:

    <script type="text/javascript" src="http://wildfireapp.com/website/302/companies/124704/widget_loader.js"></script>

    I'm not a programmer, and can't figure up how to write a cookie to control this popup. I have tried to google, got some sample, but don't know how to integrate and change them to work for me. I appreciate if you can help or show me some guidance. Thank you very much in advanced.

    Regards,
    Lester
    Not tested, but without having to manage cookies you could take a shortcut like this:

    Code:
    <?php if( !isset($_COOKIE) ) : ?>
    <script type="text/javascript" src="http://wildfireapp.com/website/302/companies/124704/widget_loader.js"></script>
    <?php endif; ?>
    This is assuming your site drops cookies of some kind of course. If that doesn't work just tie it to a specific cookie that your site drops on new visitors, like a session cookie or something.
    {{ DiscussionBoard.errors[3029297].message }}
    • Profile picture of the author ycsim4016
      Originally Posted by SpamHat View Post

      Not tested, but without having to manage cookies you could take a shortcut like this:

      Code:
      <?php if( !isset($_COOKIE) ) : ?>
      <script type="text/javascript" src="http://wildfireapp.com/website/302/companies/124704/widget_loader.js"></script>
      <?php endif; ?>
      This is assuming your site drops cookies of some kind of course. If that doesn't work just tie it to a specific cookie that your site drops on new visitors, like a session cookie or something.

      Hi, thanks for your sharing, unfortunately, the popup bar still appear after you hit closing it.

      I think the best way is still using cookies, anyone can share with me the coding?

      Thanks
      {{ DiscussionBoard.errors[3031878].message }}
      • Originally Posted by ycsim4016 View Post

        Hi, thanks for your sharing, unfortunately, the popup bar still appear after you hit closing it.

        I think the best way is still using cookies, anyone can share with me the coding?

        Thanks
        Well i tried to help but you seem to have ignored my reply.
        Signature
        {{ DiscussionBoard.errors[3032251].message }}
  • Profile picture of the author SpamHat
    That example is using cookies - you may need to edit it for your site as I mentioned.
    {{ DiscussionBoard.errors[3032236].message }}

Trending Topics