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

Is there a wordpress popup plugin which triggers based on referrer

Discussion in 'General Programming Chat' started by imserious, Apr 8, 2012.

  1. imserious

    imserious Senior Member

    Joined:
    Mar 27, 2009
    Messages:
    946
    Likes Received:
    560
    Want to know if there is a wordpress plugin which does this:

    1. If the visitor comes from google ( or any website - it check the referrer which can be defined by the webmaster) and then shows a popup.

    2. If the visitor comes from say Facebook/twitter/direct or any other website, the popup does not trigger.
     
  2. dollarkid

    dollarkid Newbie

    Joined:
    Jan 11, 2007
    Messages:
    20
    Likes Received:
    3
    No but you could add something like this to your theme's header.php -

    PHP:
    $popup "<your popup code goes here>";

    //First we check if we can get the referer
    if (isset($_SERVER['HTTP_REFERER']))
    {
        
    //next we get the hostname part of the ref url
        
    $ref parse_url($_SERVER['HTTP_REFERER']);
        
    $refhost $ref['host'];
        
        
    //now check if the refhost contains 'google'
        
    if(strpos($refhost,"google") !== false) {
            
    // its found echo the popup code
            
    echo $popup;
        }
    }
     
    • Thanks Thanks x 1
  3. brwipens

    brwipens Regular Member

    Joined:
    Nov 18, 2007
    Messages:
    245
    Likes Received:
    254
    Take a look at WpTrafficTools.
     
  4. lantrung

    lantrung Newbie

    Joined:
    Apr 30, 2012
    Messages:
    11
    Likes Received:
    1
    I remember read here about something do the similar job (based on refer). Tried to get it back in my mind but failed :(