Is there a wordpress popup plugin which triggers based on referrer

imserious

Senior Member
Joined
Mar 27, 2009
Messages
950
Reaction score
572
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.
 
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;
	}
}
 
I remember read here about something do the similar job (based on refer). Tried to get it back in my mind but failed :(
 
Back
Top