Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function other_referrers($m) {
- $s = ['twitter.com', 'instagram.com', 'tumblr.com', 'pinterest.com', 'youtube.com', 'linkedin.com'];
- foreach ($s as $source)
- {
- if ($m === $source ) {
- return $source;
- }
- }
- }
- function parse_referrer($referrer) {
- $domain = parse_url($referrer);
- //strip www off the URL
- $url = preg_replace('#^www\.(.+\.)#i', '$1', $domain['host']);
- //set match to url
- $m = $url;
- switch ($m):
- case 'www.google.com':
- return '60647'; //google adwords
- break;
- case 'www.facebook.com':
- return '8889'; //facebook
- break;
- case other_referrers($m):
- return ''; //no code for other social
- break;
- case 'themaxchallenge.com':
- return '8891'; //website
- break;
- default:
- return '60678'; //organic
- endswitch;
- }
Add Comment
Please, Sign In to add comment