How would I do this?

Discussion in 'JavaScript' started by whateverandever2, Mar 26, 2007.

  1. #1
    I wanna stick a pop under on my pages but I dont want it to pop up on every page, just once per unique user.

    I got told I could do this with javascript but have no idea where to begin?

    Thanks
     
    whateverandever2, Mar 26, 2007 IP
  2. Adi

    Adi Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Using cookies is the easiest way to do it by using only JS code. (note that some people disable JS)
    Other way to do it is to add a parameter to the query string ... this solution will be nightmare to maintain.

    If you have access to the server code - Using the session object is the right way to do it...
     
    Adi, Mar 26, 2007 IP
  3. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    There's more chance to correctly track unique users by using sessions if most of your users are using shared computers.
    Otherwise, if they mostly use their own, and you really want to track each computer (and assume 1 computer == 1 user), then use cookies.

    Of course you can always "mix and match" this by using cookies with shorter expiry time.
     
    phper, Mar 26, 2007 IP
  4. serjio28

    serjio28 Peon

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hope this can help.

    
    <?
        if(!isset($HTTP_COOKIE_VARS['unique_visitor'])){
            setcookie("unique_visitor", $value);
    ?>
    <SCRIPT LANGUAGE="javascript">
    <!--
             window.open ("popup.html","popup");
    -->
    </SCRIPT>
    <?
        };
    ?>
    
    Code (markup):
     
    serjio28, Mar 29, 2007 IP