
Detect Visitors From Twitter
Detect Visitors From Twitter
Much like some websites detect visitors from search engines and greet them in a unique way, Twitter visitors can be automatically detected as well. This is done in almost the exact same manner as search engine detections, using conditional PHP code to check for a visitor’s referral agent and greet them accordingly. here’s how it looks:
< ?php if (strpos(“twitter.com”,$_SERVER[HTTP_REFERER])==0) { echo “Hey, Twitter enthusiast! We’re glad you’re here. If you like what you see, be sure to Tweet about it and follow our account!”; } ?>
This code can be placed wherever the greeting should be displayed. Because it is entirely self-contained, there are no modifications necessary to the “functions.php” file or any other files on the FTP server. Only the template files need to be altered.