WordPress.org

Forums

[resolved] Display Link Based Upon a Cookie (2 posts)

  1. ukndoit
    Member
    Posted 2 years ago #

    I would love to make or find a plugin that when someone came to the site, like say they came through a clickbank hop link, it would have something like this:

    http://www.domain.com/?hop=NAMEHERE

    so set a cookie with name: hop value NAMEHERE

    then have it where I can set a link based upon that cookie existing:

    if $cookie['hop'] == true, link = clickbank checkout link
    else
    link = paypal checkout code

    That way, if someone finds my site any other way than a clickbank affiliate, it would checkout with Paypal saving me some money since Clickbanks rates are much, much higher... then if it is a clickbank affiliate referral, it would go ahead and use my clickbank checkout url, so that way the affiliate gets their commission...

    Anyone know of a Plugin that does that simple task?
    Thank you.
    Richard

  2. ukndoit
    Member
    Posted 2 years ago #

    I figured it out... Here is what I did:

    I created a PHP File and then have the main index.php include it once... it checks the query string and sets a cookie for it and a global variable of that value...

    then I installed a Plugin that allows PHP in posts/pages...
    now I can just put in the information I want based upon the global field being populated or not. I tested it and it works.

    I did it in the include file because that way if there is an update toe wordpress and it deletes the include_once command, I can just go add that and it will fix it again. I wish I knew how to make it a plugin so it automatically added it to the top of the file... (I had to set it at the top because to set a cookie if it is not at the top and something already printed, then I get header errors)

    Anyhow, I just wanted to say that I figured it out now.
    Richard

Topic Closed

This topic has been closed to new replies.

About this Topic