| | #1 |
| Advanced Warrior War Room Member Join Date: 2011 Location: Florida, U.S.A
Posts: 532
Thanks: 73
Thanked 45 Times in 34 Posts
|
I got this rotating redirect code php. You can have as many addresses as you want. Just ad another $aff[] = 'Put url here'; to the list. Is there a way to add google analytics on the same page as this code? I know I can put google analytics on the redirected pages. Can it be put on the same page as this code and work? <?php $k = $_GET['sub']; $aff[] = 'Put url here'; $aff[] = 'Put url here'; $aff[] = 'Put url here'; $aff[] = 'Put url here'; $aff[] = 'Put url here'; $aff[] = 'Put url here'; srand ((double) microtime() * 1000000); $random_number = rand(0,count($aff)-1); $lol = ($aff[$random_number]); $lal = $lol.$k; header("Location: $lal"); ?> |
| |
| | #2 |
| Advanced Warrior War Room Member Join Date: 2011 Location: Florida, U.S.A
Posts: 532
Thanks: 73
Thanked 45 Times in 34 Posts
|
Can anyone help with this?
|
| |
| | #3 |
| Active Warrior Join Date: 2012
Posts: 45
Thanks: 0
Thanked 9 Times in 9 Posts
|
<?php $k = $_GET['sub']; $aff[0] = 'Put url here'; $aff[1] = 'Put url here'; $aff[2] = 'Put url here'; $aff[3] = 'Put url here'; $aff[4] = 'Put url here'; $aff[5] = 'Put url here'; srand ((double) microtime() * 1000000); $random_number = rand(0,count($aff)-1); $lol = ($aff[$random_number]); $lal = $lol.$k; header("Location: $lal"); ?> All about PHP array ---> PHP Arrays No you cannot put analytics on a page redirecting usig PHP. Analytics uses Javascript that runs inside the clients web browser, this redirect uses PHP on your webserver. The visitor never sees anything that happens on this page only the redirect. |
| |
| | #4 |
| Advanced Warrior War Room Member Join Date: 2011 Location: Florida, U.S.A
Posts: 532
Thanks: 73
Thanked 45 Times in 34 Posts
|
Is there other ways of rotating redirects that can be used with analytics?
|
| |
| | #5 |
| HyperActive Warrior Join Date: 2011
Posts: 106
Thanks: 3
Thanked 12 Times in 11 Posts
|
In short, no you can't have analytics on this page. It wouldn't record any traffic. It is possible, but you would have to build your own stats tracking script; "off the shelf" analytics like google or piwik wouldn't do it without breaking the redirect. |
|
Free AdPress Theme for WordPress .
| |
| |
| | #6 |
| HyperActive Warrior War Room Member Join Date: 2009 Location: Living between LA & SD
Posts: 205
Thanks: 27
Thanked 36 Times in 33 Posts
|
tweakr is correct...this page will never hit the browser. The only thing that will get returned is the header redirect. You could record hits on this page, by using something like: INSERT INTO [the tracking db] (link, time) VALUES ('$lal, NOW()) |
| |
|
| Bookmarks |
| Tags |
| code, php, redirect, rotating |
| |