简体   繁体   中英

Google Universal Analytics event tracking for form fields

I've got a form with roughly 20 fields. There are both types of fields inputs and select. I need to send info about field usage to Google Analytics, but they allow to send only one request per event as far as I know. What I mean, is that one can't do something like

ga('send', 'event', [
    {'some.elaborate.event', 'some.elaborate.event'+$this.attr('alt'), 'username', $this.val()},
    {'some.elaborate.event', 'some.elaborate.event'+$this.attr('alt'), 'username', $this.val()},
    ...
]);

as far as I know.

Are there any solutions for such type of a problem?

You will need one http request per event (that was the case even with the "old" Universal Analytics which allowed to push multiple events at once to ga - that still resulted in multiple calls to the tracking pixel).

IMO the best approach would be to track the form submissions as transactions with each submission as a single transaction and each field as a product. This will not save code or hits (each addItem call is a single interaction hit by the defintion of the google tos), but the resulting report will be much more userfriendly than the events report (eg you can click on the id for each form submission to break down by fields).

This will of not course not work well if you are already doing transaction tracking for actual products.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM