-4

I would like to pass the contents of a form field as a event label to Google Analytics.

However, I do not want to pass any personally identifiable information due to it being against Google's terms.

I am currently using this code to extract the appropriate form field's value, however, how would I tailor it so I only get the latter part of the email address.

@icloud.com | @btinternet.com | @xxxxxx.com etc??

Thank you very much in advance.

function() {
  var field = {{Form Element}}.querySelector('#email_address');
  return field ? field.value : undefined;
}
Adam Konieska
  • 2,805
  • 3
  • 14
  • 27
  • 3
    Possible duplicate of [preg: how to write a preg pattern to get domain name from an email?](http://stackoverflow.com/questions/5181746/preg-how-to-write-a-preg-pattern-to-get-domain-name-from-an-email) – Adam Konieska May 09 '16 at 13:23

1 Answers1

1

Any part of a user's email address can be personally identifying. Although most people use email providers such as GMail, not all do.

For instance, my email address is of the form email@firstnamelastname.tld, which means if you extracted the part after the @ sign you would still have my name there, which is personally identifying, which is against Google's terms.

So the answer to this question is: don't do it.

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592