Tracking clicks on Rss Feeds, need help with code
| Author |
Message |
dusman


Joined: Mar 17, 2006 Posts: 303 Location: Maryland
|
Post subject: Tracking clicks on Rss Feeds, need help with code Posted: Tue Jan 08, 2008 5:03 pm |
|
thanks, basically what I am trying to do is use google analytics to track clicks on rss feeds in my site. My problem is getting the php variable $title2 to show up in the javascript code. I am working with line 80 in the rss.php file. Below is the code I have put into place thus far, just need to get the $title2 variable to show up in the path so I can track individual headlines.
Default code is:
//$data .= '<strong><big>·</big></strong> <a href="'.$link.'" target="new">'.$title2.'</a><br/>'."\n";
My new code:
//$data .= '<strong><big>·</big></strong> <a href="'.$link.'" target="new" rel="nofollow" onClick="javascript: pageTracker._trackPageview("/rssclicks/"$title2"");">'.$title2.'</a><br/>'."\n";
I am guessing it is an isse passing a php varialbe to javascript, but there must be some way around this, and I am also not sure how to quote out the varialbe single quote, double quote, () [] or what.
thanks for your help
_________________ -Dustin
Celebrity Babes | Celebrity Videos | Funny Videos | Information for Men
dusman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/Apache 1.3/4.1.21/5.2.1/9.2.0.RC1 |
|
| Back to top |
|
 |
Kendle


Joined: Dec 16, 2004 Posts: 529
|
Post subject: Re: Tracking clicks on Rss Feeds, need help with code Posted: Tue Jan 08, 2008 8:27 pm |
|
Code:
$data .= '<strong><big>·</big></strong> <a href="'.$link.'" target="new" rel="nofollow" onClick="javascript: pageTracker._trackPageview("/rssclicks/'.$title2.'");">'.$title2.'</a><br/>'."\n";
or
Code:
$data .= '<strong><big>·</big></strong> <a href="'.$link.'" target="new" rel="nofollow" onClick="javascript: pageTracker._trackPageview(\'/rssclicks/'.$title2.'\');">'.$title2.'</a><br/>'."\n";
_________________ Gaming League / Cup - www.leaguecms.co.uk :: Other DragonFly modules - www.cmsdreams.co.uk
Kendle's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
 |
|
| Back to top |
|
 |
dusman


Joined: Mar 17, 2006 Posts: 303 Location: Maryland
|
Post subject: Re: Tracking clicks on Rss Feeds, need help with code Posted: Tue Jan 08, 2008 8:57 pm |
|
thanks, I'll give it a shot and let reply with results
_________________ -Dustin
Celebrity Babes | Celebrity Videos | Funny Videos | Information for Men
dusman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/Apache 1.3/4.1.21/5.2.1/9.2.0.RC1 |
|
| Back to top |
|
 |
dusman


Joined: Mar 17, 2006 Posts: 303 Location: Maryland
|
Post subject: Re: Tracking clicks on Rss Feeds, need help with code Posted: Tue Jan 08, 2008 9:17 pm |
|
Looks like the first one worked, although I thought I tried that before and got an error. I didn't try the second although seems like that would work as well. Thanks for the help!
_________________ -Dustin
Celebrity Babes | Celebrity Videos | Funny Videos | Information for Men
dusman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/Apache 1.3/4.1.21/5.2.1/9.2.0.RC1 |
|
| Back to top |
|
 |
dusman


Joined: Mar 17, 2006 Posts: 303 Location: Maryland
|
Post subject: Re: Tracking clicks on Rss Feeds, need help with code Posted: Wed Jan 09, 2008 2:51 pm |
|
correction, I had to use the second option to escape the quotes, all is working great now. I can now track clicks on my RSS feeds just as I can with normal links. Thanks again
_________________ -Dustin
Celebrity Babes | Celebrity Videos | Funny Videos | Information for Men
dusman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/Apache 1.3/4.1.21/5.2.1/9.2.0.RC1 |
|
| Back to top |
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|

|
User Info ![Show/hide content [x]](themes/dragonfly/images/minus.png)
 Welcome Anonymous
Last CVS commits ![Show/hide content [x]](themes/dragonfly/images/minus.png)
Languages ![Show/hide content [x]](themes/dragonfly/images/minus.png)
Community ![Show/hide content [x]](themes/dragonfly/images/minus.png)
 Support for DragonflyCMS in a other languages:
• Deutsch
• Español
X-links ![Show/hide content [x]](themes/dragonfly/images/minus.png)
Preview theme ![Show/hide content [x]](themes/dragonfly/images/minus.png)
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.
|