1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to make a site look slightly different to returning visitors...

Discussion in 'Web Design' started by mancar487, Mar 13, 2014.

  1. mancar487

    mancar487 Jr. VIP Jr. VIP Premium Member

    Joined:
    Apr 12, 2012
    Messages:
    1,706
    Likes Received:
    1,965
    Occupation:
    Clickbank Platinum Vendor
    Hello,

    I'm posting a question that may also be of use to others.
    Basically I want to add a 'magic buy button' (timed button - it appears after a specific time interval) to my website. I have found the code to add the button, however, my problem is: I want this button to appear right from the start to returning visitors. How do I do this?

    I have found this piece of code, but I do not know how to implement it for the magic button:

    Code:
    setcookie("FirstVisit", '1');
    Code:
    function DisplayWelcomeMessage()
    {
        if (isset($_COOKIE['FirstVisit']) && $_COOKIE['FirstVisit'] == 1)
        {
             // Display a welcome message
    
    
             // Update the cookie so that they don't get this message again
             setCookie("FirstVisit", "0");
        }
        else
        {
            // Do something different for people who have visited before
        }
    }
    

    P.s the code I am using for the magic button is:

    in header:

    Code:
    <script type="text/javascript">
    $secondsdelay = 90;
    function unhide(divID) {
    var item = document.getElementById(divID);
    if (item) {
    item.className=(item.className=='hidden')?'unhidde n':'hidden';
    }
    }
    $delay = $secondsdelay*1000;
    window.setTimeout("unhide('links')",$delay);
    //--></script>
    <STYLE TYPE="text/css">
    .hidden { visibility: hidden; }
    .unhidden { visibility: visible; } 
    </STYLE>
    
    before the magic button:

    Code:
      <div id="links" class="hidden">
     
  2. Gorsko

    Gorsko Junior Member

    Joined:
    Oct 31, 2011
    Messages:
    122
    Likes Received:
    70
    Shoot me a PM with your skype, i'll help you out, for free of course.
     
    • Thanks Thanks x 1
  3. mancar487

    mancar487 Jr. VIP Jr. VIP Premium Member

    Joined:
    Apr 12, 2012
    Messages:
    1,706
    Likes Received:
    1,965
    Occupation:
    Clickbank Platinum Vendor
    Thank you so such for solving this for free, you're an amazing programmer and a great guy!
    P.S. you can post the script here, it may help others. Thanks a million :)
     
  4. Gorsko

    Gorsko Junior Member

    Joined:
    Oct 31, 2011
    Messages:
    122
    Likes Received:
    70
    No problem man, glad i could help you out.

    And yea, in case someone else needs this script here it is:

    Code:
    
    <html>
    <head>
    
    
    <title>Test</title>
    
    
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    
    
           <script type="text/javascript">
    	   
    	   function getCookie(name) {
    		var dc = document.cookie;
    		var prefix = name + "=";
    		var begin = dc.indexOf("; " + prefix);
    		if (begin == -1) {
    			begin = dc.indexOf(prefix);
    			if (begin != 0) return null;
    		}
    		else
    		{
    			begin += 2;
    			var end = document.cookie.indexOf(";", begin);
    			if (end == -1) {
    			end = dc.length;
    			}
    		}
    		return unescape(dc.substring(begin + prefix.length, end));
    	} 
    
    
    	function checkit() {
    		var myCookie = getCookie("FirstTime");
    
    
    		if (myCookie == null) {
    			// do cookie doesn't exist stuff;
    			setTimeout(function() { document.getElementById('links').style.display ='block'}, 5000)
    			document.cookie = 'FirstTime=test; expires=Fri, 3 Aug 2050 20:47:11 UTC; path=/';
    		}
    		else {
    			// do cookie exists stuff
    			setTimeout(function() { document.getElementById('links').style.display ='block'}, 1)
    		
    		}
    	}
    	   
    		</script>
    
    
    </head>
    
    
    <body onload="checkit();">
    
    
    <div id="links" style="display: none;">
    BUTTON HERE
    </div>
    
    
     
    • Thanks Thanks x 6
  5. seocompanymail

    seocompanymail Regular Member

    Joined:
    Nov 15, 2010
    Messages:
    294
    Likes Received:
    114
    Home Page:
    Thanks that is very useful