How to create a unique identifier for tracking?

An event tracking brain teaser Google Analytics - how do you capture a form value before it's been captured?

  • I have event tracking on our email-drops at http://60daymba.com/ set up and working more accurately (the initial reason) than the mere destination-based goals we have up. Tracking when someone hits the thank-you page isn't very accurate for reasons I won't get into. So I set up event tracking with Google Analytics so we can not only to log when people push the submit button and those track as a conversion to email address, with far better accuracy as well as better granularity for WHERE they dropped their email - and a few other things... but the ultimate granularity and what we want so we can track all the way to sale by email address (which is our unique identifier for a customer) instead of just channels/cookies. this is a much more definitive way to know where the money is coming from. Right now as part of each <form> on the website that takes an email drop, we have something very similar to the following as the submit button tag: <input onClick="_gaq.push(['_trackEvent', 'EmailsDropped', 'OnSubmit', 'HomePageTopDrop', ']);"  type="submit" value="START WITH 5 FREE CASE STUDIES" > I believe the best way to accomplish my goal is to set the event tracking 'value' field such as it is immediately below (a very slight modification to the above input tag) However, I don't know how to get the actual email address into the value field, as the form has not been submitted until the input button is pressed, and thus has not been processed at the time I wish to do so. Maybe I'm thinking about this in the wrong way? <input onClick="_gaq.push(['_trackEvent', 'EmailsDropped', 'OnSubmit', 'HomePageTopDrop', '<?php theActuallEmailAddressValue; ?>']);"  type="submit" value="START WITH 5 FREE CASE STUDIES" > Any help greatly appreciated. This is reposted from here: https://plus.google.com/+DaveLlorens/posts/Vy4WGUa6Rr5 https://plus.google.com/s/%23eventtracking   https://plus.google.com/s/%23googleanalytics   https://plus.google.com/s/%23googleanalyticsacademy

  • Answer:

    You will need to add a form submit handler in JavaScript that can capture the email address before the form is submitted. Then you can fire a Google analytics event with your values. After that let the form submission proceed. I would recommend using jQuery to do the dirty work.

Puru Choudhary at Quora Visit the source

Was this solution helpful to you?

Other answers

That being said, email adresses are considered pii and are not allowed to be stored in google analytics... "Google Analytics customers are prohibited from sending personal information to Google. The Google Analytics terms of service, which all Google Analytics customers must adhere to, prohibits sending personally identifiable information (PII) to Google Analytics (such as names, social security numbers, email addresses, or any similar data), or data that permanently identifies a particular device (such as a mobile phone’s unique device identifier if such an identifier cannot be reset), even in hashed form. Your Google Analytics account could be terminated and your data destroyed if you use any of this information."

Rick Dronkers

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.