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 Mark Forums Read
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-21-2012, 05:29 PM   #1
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 54,439
anyone track clicks inside an element using GA?

anyone ever thought of tracking clicks inside a div?

like a video

<div id="video">
{embed}
{textlink}
</div>

anyone doing this using GA?

here is the code for anyone who wants to try it

Code:
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>test</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="jquery.ga.js"></script>

    <script>
    jQuery(document).ready(function($){
	$.ga('UA-XXXXXX-X');
	$('#video').ga('click', ['_trackEvent', 'Videos', 'Play', 'videoid=197', '0']);
    });
    </script>
  </head>

  <body>

    <div id="video">
	{links here}
    </div>

  </body>
</html>

// ga jquery plugin

(function($){
	var load = false;
	var queue = new Array();
	
	var gaPush = function(){
		if ((typeof _gaq != undefined) && load){
			_gaq.push(arguments[0]);
		} else if (!load) {
			queue.push(arguments[0]);
		} else {
			$.error('_gaq is undefined');
		}
	};

	$.ga = function(){
		if (typeof arguments[0] === 'object'){
			gaPush(arguments[0]);
		} else if (typeof arguments[0] === 'string'){
			var ua = arguments[0];
			gaPush(['_trackPageview']);
			$.ajax({type: 'GET', url: ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js', cache: true, dataType: 'script', data: null}).complete(function(){
				load = true;
				queue.unshift(['_setAccount', ua]);
				$.each(queue, function(ind){
					gaPush(queue[ind]);
				});
			});
		}
	};
	
	$.fn.ga = function(){
		if (typeof arguments[0] === 'string') {
			var event = arguments[0];
			var args = arguments[1];
			return this.each(function(){
				var $this = $(this);
				$this.bind(event + '.ga', function(){
					gaPush(args);
				});
			});
		} else {
			return this;
		}
	};
})(jQuery);
__________________
My WP Tube Themes
fris at fris.net
fris is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-22-2012, 07:15 AM   #2
react
Confirmed User
 
Industry Role:
Join Date: Sep 2003
Location: NZ
Posts: 673
Yup, using event tracking for Flash.
__________________
--
react
react is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-22-2012, 08:13 AM   #3
Love Sex
Confirmed User
 
Join Date: Nov 2004
Posts: 1,905
do you mean like pixel tracking
Love Sex is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-22-2012, 08:20 AM   #4
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 54,439
Quote:
Originally Posted by Love Sex View Post
do you mean like pixel tracking
no i mean click tracking inside an element, say you have a textlink to a tour inside the <div id="video">

element, it would assign a custom variable for google analytics and track that.
__________________
My WP Tube Themes
fris at fris.net
fris is online now   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
Thread Tools



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.