Track form submission that is not submitted anywhere

I have an overlay with a form (only a group of radio buttons with 3 buttons and a submit button) that when sending use jQuery to open a specific file (PDF) in a new tab, and then close the overlay. The file depends on which button was selected. Problem: the form does not actually submit, so I don’t know how to track the submission, and the client wants to know the percentage of people by clicking each button.

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

Any ideas? Is this enough information? I can post the code, but it includes cookies and Thickbox and will just add more confusion for anyone trying to understand the situation.

+3
source share
3 answers

A function _trackPageview()that is part of the standard tracking code that you embed in your web pages can also be called using the argument string at any time to create a request for a virtual page for Google Analytics.

Google Analytics _trackPageview ga.js , , . _trackPageviewJavaScript, Flash-, JavaScript, , ..

. JavaScript? Google Analytics.

+3

javascript, 1) ajax ( ) 2) PDF .

, PDF-, , .

+1

JQuery , AJAX URL.

[Edit] Sorry, this answer is sadly unclear. According to the comment below, the URL to which you are sending the AJAX request should be tracked by the servers, since the scripts will not run when the page was requested using XmlHttpRequest. Therefore, Google analytics will not work in this example.

0
source

Source: https://habr.com/ru/post/1721223/


All Articles