Guest User

Untitled

a guest
Nov 17th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. function other_referrers($m) {
  2. $s = ['twitter.com', 'instagram.com', 'tumblr.com', 'pinterest.com', 'youtube.com', 'linkedin.com'];
  3. foreach ($s as $source)
  4. {
  5. if ($m === $source ) {
  6. return $source;
  7. }
  8. }
  9. }
  10.  
  11.  
  12. function parse_referrer($referrer) {
  13. $domain = parse_url($referrer);
  14. //strip www off the URL
  15. $url = preg_replace('#^www\.(.+\.)#i', '$1', $domain['host']);
  16. //set match to url
  17. $m = $url;
  18.  
  19. switch ($m):
  20. case 'www.google.com':
  21. return '60647'; //google adwords
  22. break;
  23. case 'www.facebook.com':
  24. return '8889'; //facebook
  25. break;
  26. case other_referrers($m):
  27. return ''; //no code for other social
  28. break;
  29. case 'themaxchallenge.com':
  30. return '8891'; //website
  31. break;
  32. default:
  33. return '60678'; //organic
  34. endswitch;
  35. }
Add Comment
Please, Sign In to add comment