I am adding the following code to the function.php file to achieve Google Analytics Event Triggers. I believe the code is right.
add_action("gform_after_submission", "gf_ga_tracking", 10, 2);
function gf_ga_tracking($entry, $form) {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
_gaq.push(['_trackEvent', 'Forms', 'Submission', '<?php echo $form["title"]; ?>']);
});
</script>
<?php }
but I am receiving a ReferenceError: jQuery is not defined @ http://domain.com/request-service/#gf_5:3
I know I have to have jQuery added to the page. But I figured it was taken care of by another plugin from the following code on my page:
<script type='text/javascript' src='http://domain.com/wp-content/plugins/wp-lightbox/js/jquery.min.js?ver=1.7.1'></script>
Does it need to be a specific version?
I disabled the plugin and I tried adding jquery by adding the following code into function.php:
add_action('init', 'add_jquery');
function add_jquery() {
wp_enqueue_script('jquery');
}
now it has the following code in the page source: <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script>
but still gives me the jquery not defined error.
Thanks
Greg