smithmr8 Posted May 20, 2011 Share Posted May 20, 2011 I've got a page which has a 301 Redirect. Is there anyway to put the google analytics tracking codes on the page ? I've tried, but because its output, it doesn't work before the 301 Header Redirect. Don't think there is, but worth a try. Cheers. Link to comment https://forums.phpfreaks.com/topic/236997-google-analytics-before-301-redirect/ Share on other sites More sharing options...
requinix Posted May 20, 2011 Share Posted May 20, 2011 Not like that: the redirect will kick in and the browser won't bother with the content. Can you put the analytics on the target page? Link to comment https://forums.phpfreaks.com/topic/236997-google-analytics-before-301-redirect/#findComment-1218190 Share on other sites More sharing options...
smithmr8 Posted May 20, 2011 Author Share Posted May 20, 2011 It's a URL shortening service. So the target pages aren't mine. Which is my conundrum. I can get stats via the server. Was just wondering if I could add google analytics to the redirect script so I could get some analytics on it. Bit of a long shot. ;-) Link to comment https://forums.phpfreaks.com/topic/236997-google-analytics-before-301-redirect/#findComment-1218207 Share on other sites More sharing options...
matthew9090 Posted May 20, 2011 Share Posted May 20, 2011 You could try and use a meta tag to redirect after 0 seconds and put the analytics code first. Link to comment https://forums.phpfreaks.com/topic/236997-google-analytics-before-301-redirect/#findComment-1218218 Share on other sites More sharing options...
smithmr8 Posted May 20, 2011 Author Share Posted May 20, 2011 Yeah, that would work. But I need the 301 redirect. Most efficient type of redirection. I'll just use the server stats. It'll be fine :-P Link to comment https://forums.phpfreaks.com/topic/236997-google-analytics-before-301-redirect/#findComment-1218220 Share on other sites More sharing options...
requinix Posted May 20, 2011 Share Posted May 20, 2011 But I need the 301 redirect. Most efficient type of redirection. It's efficient because it doesn't make the client do pesky things like inspect the response body... You get one or the other - pick which you care about most. Link to comment https://forums.phpfreaks.com/topic/236997-google-analytics-before-301-redirect/#findComment-1218264 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.