Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Search Search
Search for:
Tech Support Guy > > >

PHP code doesn't work, is it wrong? PHP Redirect code.


(!)

tnomal2008's Avatar
tnomal2008 tnomal2008 is offline
Member with 5 posts.
THREAD STARTER
 
Join Date: Aug 2008
31-May-2012, 09:49 AM #1
PHP code doesn't work, is it wrong? PHP Redirect code.
Can anyone assist? I'm not a programmer so please forgive me in advance.

Iíve tested the code below but itís not redirecting (no errors on the page) As an FYI, I tested only using two incoming links, I added the third elseif here for better clarification.

----------------------------------------------------------------------------------------------


Problem:

Need to capture campaign ID from print ads and/or direct links. An easy fix would be a tracking pixel on the page but our current analytics program does not provide it (canít purchase another program, our company is too invested in the current).

Goal:

To just add another elseif expression for new print ads and/or redirects, i.e. until our analytics company develops a solution (simple as opposed to creating a sub domain w/ a redirect for each new incoming link)


Important Notes:

The code should be case sensitive because the incoming link may sometimes come from same domain but with a different campaign ID (see example below)

I did manage to capture the campaign ID using to two domain autoforwards but that will only work for one incoming link.

----------------------------------------------------------------------------------------------

EXAMPLE

Print Ad URL #1 >>>domain autoforward>>> http://www.PurchasedDomain55.com/?ut...paign=PrintAD1 >>>php redirect>>> http://www.DestinationPage44.com/?ut...&utm_campaign= PrintAD1

Print Ad URL #2 >>>domain autoforward>>> http://www.PurchasedDomain55.com/?ut...&utm_campaign= PrintAD2 >>>php redirect>>> www. DestinationPage44.com/?utm_source=blog&utm_campaign= PrintAD2

Print Ad URL #3 >>>domain autoforward>>> http://www.PurchasedDomain55.com/?ut...&utm_campaign= PrintAD3 >>>php redirect>>> www. DestinationPage44.com/?utm_source=blog&utm_campaign= PrintAD3

----------------------------------------------------------------------------------------------
CODE

<?php $referrer = $_SERVER['HTTP_REFERER'];
if (stripos($referrer, ' http://www.PurchasedDomain55.com/?ut...paign=PrintAD1 ') !== false)
{ header("location: http://www.DestinationPage44.com/?ut...&utm_campaign= PrintAD1"); }

elseif (stripos($referrer, ' http://www.PurchasedDomain55.com/?ut...&utm_campaign= PrintAD2 ') !== false)
{ header("location: www. DestinationPage44.com/?utm_source=blog&utm_campaign= PrintAD2"); }

elseif (stripos($referrer, ' http://www.PurchasedDomain55.com/?ut...&utm_campaign= PrintAD3 ') !== false)
{ header("location: www. DestinationPage44.com/?utm_source=blog&utm_campaign= PrintAD3"); }

?>
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
php

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑