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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 04-15-2008, 04:34 PM   #1
fluffygrrl
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("&#37;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>
Here's my homegrown effort at tracking clicks to iframes :

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;
}
}
Now in theory, this script should call the function whenever it sees the sponsor's domain, and the function should increment the goal hits for google analytics.

It is however not werking. Anyone can spot the bug ? My eyes are crossing already.
fluffygrrl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-16-2008, 05:29 AM   #2
fluffygrrl
So Fucking Banned
 
Join Date: May 2006
Posts: 2,187
Anybody ?
fluffygrrl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-16-2008, 05:36 AM   #3
StuartD
Sofa King Band
 
StuartD's Avatar
 
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.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-16-2008, 05:54 AM   #4
fluffygrrl
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>
Works as expected.
fluffygrrl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-16-2008, 11:23 AM   #5
fluffygrrl
So Fucking Banned
 
Join Date: May 2006
Posts: 2,187
Bump for this, you never know.
fluffygrrl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-16-2008, 02:43 PM   #6
fluffygrrl
So Fucking Banned
 
Join Date: May 2006
Posts: 2,187
Final bump.
fluffygrrl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-16-2008, 03:49 PM   #7
Dvae
Confirmed User
 
Dvae's Avatar
 
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.
Dvae is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-16-2008, 04:52 PM   #8
fluffygrrl
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 ?
fluffygrrl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-17-2008, 03:21 AM   #9
Dvae
Confirmed User
 
Dvae's Avatar
 
Industry Role:
Join Date: Feb 2005
Location: US
Posts: 5,326
Quote:
Where do you see the issue ?
I would need a more complete example or link where you have it set up to be able to tell.
Dvae is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-17-2008, 10:20 AM   #10
fluffygrrl
So Fucking Banned
 
Join Date: May 2006
Posts: 2,187
Say http://lolcunts.com
fluffygrrl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-17-2008, 12:39 PM   #11
Dvae
Confirmed User
 
Dvae's Avatar
 
Industry Role:
Join Date: Feb 2005
Location: US
Posts: 5,326
Quote:
Originally Posted by fluffygrrl View Post
First thing is since you have your script in the body it gets called as it loads. and you have the iframe loading after the script runs.
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;
}
}
In this way you can step through it and get some feedback.

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)

Last edited by Dvae; 04-17-2008 at 12:40 PM..
Dvae is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.