Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tracking submissions of a form which doesn't submit anywhere

I have an overlay with form (just a radio button group with 3 buttons and a submit button) that, on submit, uses jQuery to open a specific file (a PDF) in a new tab and then close the overlay. The file depends on which button was selected. The problem: the form doesn't actually submit so I don't know how to track submissions, and the client wants to know the percentage of people clicking each button.

How can I track that? I can't track actual submissions because obviously nothing gets POST'ed or GET'ed, and I can't track Google Analytics clicks because GA only tracks clicks on links, not on form buttons.

Any ideas? Is this enough info? I can post the code, but it involves cookies and Thickbox and would just add more confusion to anyone trying to understand the situation.

like image 900
Mike Crittenden Avatar asked Oct 18 '25 16:10

Mike Crittenden


1 Answers

Function _trackPageview()—that is part of the standard tracking code you embed in your web pages—could be also called with an argument string at anytime to generate a virtual page request for Google Analytics.

Google Analytics' _trackPageview is a function for use on ga.js tracked sites that allows you to track events on your site that do not generate a pageview. Using the _trackPageview JavaScript, you can assign a specific page filename to Flash events, JavaScript events, file downloads, outbound links, and more.

For further details see article How do I track JavaScript events? in Google Analytics Help Center.

like image 86
viam0Zah Avatar answered Oct 21 '25 05:10

viam0Zah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!