-
-
Save Shoora/0a3cb400b4bf36e81597 to your computer and use it in GitHub Desktop.
jquery.gaformanalysis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gaForm = gaForm || {}; | |
jQuery(function($) { | |
var defaults = { | |
Forms:"#form", | |
Category:"analysisForm", | |
Action:"id", | |
inputRadio: true, | |
inputSelect: true, | |
inputCheckBox: true | |
}; | |
var options = $.extend(defaults, gaForm); | |
$(options.Forms+' input:submit').click(function() { | |
var radio = $(options.Forms+' input:radio:checked'); | |
var formtext = $(options.Forms+' input:text'); | |
jQuery.each(formtext, function(i,val) { | |
_gaq.push(['_trackEvent', options.Category, $(this).attr(options.Action), $(this).val()]); | |
}); | |
jQuery.each(radio, function(i,val) { | |
_gaq.push(['_trackEvent', options.Category, $(this).attr(options.Action), $(this).val()]); | |
}); | |
var select = $(options.Forms+' select'); | |
jQuery.each(select, function(i,val) { | |
_gaq.push(['_trackEvent', options.Category, $(this).attr(options.Action), $(this).val()]); | |
}); | |
var checkbox = $(options.Forms+' input:checkbox:checked'); | |
jQuery.each(checkbox, function(i,val) { | |
_gaq.push(['_trackEvent', options.Category, $(this).attr(options.Action), $(this).val()]); | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gaForm = gaForm || {}; | |
jQuery(function($) { | |
var defaults = { | |
Forms:".wpcf7-form", | |
Category:"DATAFORM", | |
Action:"class", | |
inputRadio: true, | |
inputSelect: true, | |
inputCheckBox: true | |
}; | |
var options = $.extend(defaults, gaForm); | |
$(options.Forms+' input:submit').click(function() { | |
var radio = $(options.Forms+' input:radio:checked'); | |
var formtext = $(options.Forms+' input:text'); | |
var textareatext = $(options.Forms+' textarea'); | |
jQuery.each(formtext, function(i,val) { | |
/* console.log("send","event",options.Category,$(this).attr(options.Action),$(this).val()) */ | |
ga("send","event",options.Category,$(this).attr(options.Action),$(this).val()) | |
}); | |
jQuery.each(textareatext, function(i,val) { | |
/* console.log("send","event",options.Category,$(this).attr(options.Action),$(this).val()) */ | |
ga("send","event",options.Category,$(this).attr(options.Action),$(this).val()) | |
}); | |
jQuery.each(radio, function(i,val) { | |
/* console.log("send","event",options.Category,$(this).attr(options.Action),$(this).val()) */ | |
ga("send","event",options.Category,$(this).attr(options.Action),$(this).val()) | |
}); | |
var select = $(options.Forms+' select'); | |
jQuery.each(select, function(i,val) { | |
/* console.log("send","event",options.Category,$(this).attr(options.Action),$(this).val()) */ | |
ga("send","event",options.Category,$(this).attr(options.Action),$(this).val()) | |
}); | |
var checkbox = $(options.Forms+' input:checkbox:checked'); | |
jQuery.each(checkbox, function(i,val) { | |
/* console.log("send","event",options.Category,$(this).attr(options.Action),$(this).val()) */ | |
ga("send","event",options.Category,$(this).attr(options.Action),$(this).val()) | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment