eXceem

Go Back   eXceem > Websites > Website Discussion

Claim your amazing £1,000 slots booster bonus now!


Google Analytics - PHP

This is a discussion on Google Analytics - PHP within the Website Discussion forums, part of the Websites category; Not sure how you can get this to work as you cannot run anything with an output before the redirect. ...

Reply
 
Thread Tools
Old 30-11-11, 11:50 AM   #21
Looking for a new job!!
 
ndev2k's Avatar
 
Join Date: Jun 2008
Location: St Helens
Posts: 4,277
ndev2k is a name known to allndev2k is a name known to allndev2k is a name known to allndev2k is a name known to all
Send a message via MSN to ndev2k Send a message via twitter to ndev2k
Not sure how you can get this to work as you cannot run anything with an output before the redirect. The only possible solution would be to use output buffering but there is no guarantee that this would run the complete javascript for the analytics code before redirecting.
__________________
Free Stuff |Free iPhone 3GS | Free Nintendo Wii | Free PS3 | Free Stuff
Spoiler

 
Reply With Quote
Old 30-11-11, 11:52 AM   #22
Currently: Moderating!
 
MJ10's Avatar
 
Join Date: Nov 2008
Location: Thatcham, Reading
Posts: 15,787
MJ10 is a splendid one to beholdMJ10 is a splendid one to beholdMJ10 is a splendid one to beholdMJ10 is a splendid one to beholdMJ10 is a splendid one to behold
Send a message via twitter to MJ10
Hmm, I guess I'll just have to leave it. Was just hoping I could do some more in depth analysis of what links worked best.

Thanks anyway for trying!
__________________
Spoiler
2011 Winner of Best Site Award and Grammanazi Award. Runner up for Member of the Year 2011

Free iPhone | Free iPhone | Free iPad 3 | Sign Define App | Freebie Proof Photo Blog

Total Received: £7,446.87 plus Current Stats: 0 green 12 pending


WIN an iPod Shuffle, XBox Live, Amazon or iTunes vouchers
>> Free competition entry here <<










Spoiler

Spoiler

Spoiler
 
Reply With Quote
Old 30-11-11, 12:07 PM   #23
Looking for a new job!!
 
ndev2k's Avatar
 
Join Date: Jun 2008
Location: St Helens
Posts: 4,277
ndev2k is a name known to allndev2k is a name known to allndev2k is a name known to allndev2k is a name known to all
Send a message via MSN to ndev2k Send a message via twitter to ndev2k
The best bet would be to include a counter on the links. Might be something to ask Charlie about
__________________
Free Stuff |Free iPhone 3GS | Free Nintendo Wii | Free PS3 | Free Stuff
Spoiler

 
Reply With Quote
Old 30-11-11, 01:14 PM   #24
iPod 30gb
 
Join Date: Aug 2009
Location: Widnes
Posts: 1,090
cono1717 is a jewel in the rough
I assume your trying to find out if ?id=freeipod is clicked more than ?id=freeipad ?

You could just have one redirect page and use the ?id=XXXXX tags so like
Code:
<?php
$site = $_GET['id'];
$sql = mysql_query("SELECT * FROM `clicks` WHERE `site` = '$site'");
$row = mysql_fetch_array($sql);

$old = $row['clicks'];
$new = $old +1;
mysql_query("INSERT INTO `clicks` (`id`, `amount`) VALUES ('$site', '$new')");


REDIRECT CODE
Haven't tested that but that's my general idea.
__________________
Totally Free iPad | McFlurry Ice Cream Van

Everything I say reflects my own opinions and not that of any company.
 
Reply With Quote
Old 30-11-11, 01:52 PM   #25
Looking for a new job!!
 
ndev2k's Avatar
 
Join Date: Jun 2008
Location: St Helens
Posts: 4,277
ndev2k is a name known to allndev2k is a name known to allndev2k is a name known to allndev2k is a name known to all
Send a message via MSN to ndev2k Send a message via twitter to ndev2k
Could you not simply expand on that and still use the same redirect code from the _GET statement after the counter had been added to? The parameter will still be the same even after the click has been added to the database

Or am I missing something again.

p.s. You will also have to put in the SQL connect parameters. I am going to have a play around with this later as I want to incorporate the redirect on my site and would like it to count clicks.

Will let you know how I get on.
__________________
Free Stuff |Free iPhone 3GS | Free Nintendo Wii | Free PS3 | Free Stuff
Spoiler


Last edited by ndev2k; 30-11-11 at 01:53 PM..
 
Reply With Quote
Old 30-11-11, 02:27 PM   #26
Mini Mac
 
chigley's Avatar
 
Join Date: Sep 2006
Location: Bolton/London (home/uni.)
Posts: 8,424
chigley has a reputation beyond reputechigley has a reputation beyond reputechigley has a reputation beyond reputechigley has a reputation beyond reputechigley has a reputation beyond reputechigley has a reputation beyond reputechigley has a reputation beyond repute
Send a message via MSN to chigley
Quote:
Originally Posted by cono1717 View Post
I assume your trying to find out if ?id=freeipod is clicked more than ?id=freeipad ?

You could just have one redirect page and use the ?id=XXXXX tags so like
Code:
<?php
$site = $_GET['id'];
$sql = mysql_query("SELECT * FROM `clicks` WHERE `site` = '$site'");
$row = mysql_fetch_array($sql);

$old = $row['clicks'];
$new = $old +1;
mysql_query("INSERT INTO `clicks` (`id`, `amount`) VALUES ('$site', '$new')");


REDIRECT CODE
Haven't tested that but that's my general idea.
mysql_real_escape_string() is your friend It escapes user input to stop them doing nasty SQL injections.

For example, if I went to yourfile.php?id='; DROP TABLE `clicks`;--, assuming I haven't made any mistakes, I could delete your table
 
Reply With Quote
Old 30-11-11, 03:58 PM   #27
iPod 30gb
 
Join Date: Aug 2009
Location: Widnes
Posts: 1,090
cono1717 is a jewel in the rough
I have a script set up on my pc that everytime I use $_GET it rewrites it to the escape, was using my macbook for that and so didn't set textexpander up for it.

But yes, use charlie's so it would be

$site = mysql_real_escape_string($_GET['id']);
__________________
Totally Free iPad | McFlurry Ice Cream Van

Everything I say reflects my own opinions and not that of any company.

Last edited by cono1717; 30-11-11 at 03:59 PM..
 
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off





All times are GMT. The time now is 08:27 PM.
All trademarks and copyrights held by respective owners. Forum posts are owned by the poster.

Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO
no new posts