![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
So Fucking Banned
Join Date: May 2006
Posts: 2,187
|
Any javascript experts ?
I have an issue with tracking clicks via google analytics.
Here's the google tracking code : Code:
<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-xxxxxx-x"); pageTracker._initData(); pageTracker._trackPageview(); </script> Code:
<script type="text/javascript"> function trackLC(){ pageTracker._trackPageview('/G3/LC.html');} var elements; if(document.getElementsByTagName) { elements = document.body.getElementsByTagName("IFRAME"); } else if (document.body.all) { elements = document.body.all.tags("IFRAME"); } else { elements = array(); } for(var i = 0; i < elements.length; i++) { if(elements[i].src.indexOf("xxxblackbook.com") > -1) { elements[i].onfocus = trackLC; } } It is however not werking. Anyone can spot the bug ? My eyes are crossing already. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
So Fucking Banned
Join Date: May 2006
Posts: 2,187
|
Anybody ?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Sofa King Band
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
|
Your code looks fine but I don't know enough about google's code to know if that's the proper way to pass along page information to it.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
So Fucking Banned
Join Date: May 2006
Posts: 2,187
|
Well fuck me, I've read the thing 500 times, I still got no clue what's going wrong.
However, this Code:
<a href="url here" onClick="javascript: pageTracker._trackPageview('track page here');">anchor</a> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
So Fucking Banned
Join Date: May 2006
Posts: 2,187
|
Bump for this, you never know.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
So Fucking Banned
Join Date: May 2006
Posts: 2,187
|
Final bump.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Feb 2005
Location: US
Posts: 5,326
|
I have a feeling this may have something to do with crossframe scripting and security.
http://msdn2.microsoft.com/en-us/lib...28(VS.85).aspx Second, what errors are you getting? Do you have the error console installed? If you do this should give you at least a hint what the problem may be. The error console is a Firefox addon, don't know about IE. Firebug is also a good addon. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
So Fucking Banned
Join Date: May 2006
Posts: 2,187
|
There's no javascript errors at all.
In principle, there shouldn't be a xfs issue, seeing how my script does not write anything at all, it merely reads iframed content and then calls a function. Where do you see the issue ? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
Confirmed User
Industry Role:
Join Date: Feb 2005
Location: US
Posts: 5,326
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
So Fucking Banned
Join Date: May 2006
Posts: 2,187
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Confirmed User
Industry Role:
Join Date: Feb 2005
Location: US
Posts: 5,326
|
Quote:
Try flip-flopping that. I got a different result when I ran it that way. This could be put in the head tags then use an onload call in the body tags. Also you can add some alerts like so: Code:
function trackLC(){ pageTracker._trackPageview('/G3/LC.html'); } var elements; if(document.getElementsByTagName) { elements = document.body.getElementsByTagName("IFRAME"); alert("if" +elements) } else if (document.body.all) { alert("else if") elements = document.body.all.tags("IFRAME"); } else { alert("else") elements = array(); } alert("b4 for") for(var i = 0; i < elements.length; i++) { alert("for"+elements[i]) if(elements[i].src.indexOf("xxxblackbook.com") > -1) { alert("for in if elements"+elements[i]) elements[i].onfocus = trackLC; } } Other than that I would need to have a way to know if its working such as the log file (I'm assuming its writing to) |
|
![]() |
![]() ![]() ![]() ![]() ![]() |