Display WordPress content only for visitors from Google

Sometimes we want to display dynamic content based on where the visitor has come from. The place where the vistor link your website link from is called a “Referer”, so when someone clicks your link on Google, then Google is the referer. Using PHP we can target users coming from Google, we can then show them unique content or a deal. The code below simply echo’s a string as an example. You will need wrap your specific content inside the brackets.
[cc lang=”php”]
// Display on for visitors coming from Google
if (strpos($_SERVER[HTTP_REFERER], “google”) == true) {
// Code for Google vistors
echo “30% off today”;
}[/cc]