server side you can control source, campaign and medium that way.
> I guess I doesn't expressed well.
> What I wanted to say is...
> <?php
> header('Location: mypage.php?redirect=301');
> ?>
> In mypage.php he can check if the user was redirected and apply the JS
> code.
> <?php
> if (!empty($_GET['redirect']))
> {
> switch ($_GET['redirect'])
> {
> case 301:
> $attach_code = 301;
> break;
> case 302:
> $attach_code = 302;
> break;
> case 404:
> $attach_code = 404;
> break;
> default:
> $attach_code = 200;
> }
> }
> ?>
> So he doesn't have to track the redirect page but instead he can track
> if the user comes from a redirected page. The $attach_code could
> insert a new segment for example. It is a more backwards directed
> tracking.
> But maybe it is just nonsense what I wrote :-) I am new to GA as well.
> On Nov 6, 9:51 pm, ShoreTel wrote:
> > If the redirect is server-side (ie. a 301, 302, or a "Location: "
> > header) there is no page rendered in the browser.
> > If you use META refresh, or JavaScript to do the redirect you can,
> > because the redirect is being done by the page instead of the server.
> > On Nov 6, 1:51 am, suntrop wrote:
> > > Isn't it possible to add some javascript to the redirect URL?
> > > Or is this not working with js only php? Otherwise he could add a
> > > variable or a segment and filter it in GA.
> > > On Nov 5, 7:11 pm, ShoreTel wrote:
> > > > You can't.
> > > > A redirect forces the browser to go to a different URL without
> > > > rendering a page. No page, then no javascript. No javascript, then no
> > > > tracking.
> > > > On Nov 5, 6:54 am, flysaa wrote:
> > > > > I have following php code on a website of ours that we direct
> > > > > customers from offline promotions to which I would like to include in
> > > > > the tracking:
> > > > > <?php
> > > > > header("HTTP/1.1 301 Moved Permanently");
> > > > > header('Location:http://ww3.flysaa.com/de/reservation/de_resmultilegsearch_content.htm...
> > > > > exit();
> > > > > ?>
> > > > > How can I have Google Analytics tracking for this site?
> > > > > I tried following code but do not seem to get any data:
> > > > > <?php
> > > > > header("HTTP/1.1 301 Moved Permanently");
> > > > > header('Location:http://ww3.flysaa.com/de/reservation/de_resmultilegsearch_content.htm...
> > > > > $virtual_page = "Pressemitteilung_November";
> > > > > include_once("analyticstracking.php");
> > > > > exit();
> > > > > ?>
> > > > > Thanks for your help.