I have a webpage with a ‘Start test’ button, I would like to track the value of an input: <input id="RepeatsInput" type="text" /> every time the button is clicked through Google analytics – bearing in mind I am using Google analytics to track the pageviews (this will have happened already before the user presses the button). What snippet of code should I use for this?
Thanks in advance.
Since it is not known exactly how the HTML is set up, consider this example:
HTML:
JS:
Google’s documentation on Custom Variables explains that another
_trackPageviewwill need to be called for custom variables set by user events.Event tracking may be another way to address this.