1

I can't seem to find any info on how to do this but basically on submit I need to send either the mobile number the user inputted or the email not both, just one or the other.

_gaq.push(['_trackEvent', 'Friday Deals', 'Music and Sports', '[48r6KevWQkGNIgjRc95owg or xwPuPgV9D0ifMwjRc95swg]']);

In the array you will see the first name ( This is the mobile number name ) the second is the email name.

I am using the name attribute on the inputs.

Is this correct? How can I test to see if this is working in Chrome?

1

1 Answer 1

1

You can't do this. Sending personal data (like emails or phone numbers) to Google Analytics is against their Terms of service (Section 7):

You will not (and will not allow any third party to) use the Service to track, collect or upload any data that personally identifies an individual (such as a name, email address or billing information), or other data which can be reasonably linked to such information by Google.

Talking generally, if you really want to register only one data point of the two potentially available, it should be done server-side (the exact code depends obviously on what system and language are you using) and sent the result as a parameter to Google Analytics .

Alternatively, you could obviously register two data points at the same time (not just one or the other) using two parameters. You can put for example one as the "action" parameter and the other as the "label" parameter, like in this example

_gaq.push(['_trackEvent', 'Friday Deals', 'DATA1', 'DATA2']);

Or use the other optional parameter "value" to register a number. For example:

_gaq.push(['_trackEvent', 'Friday Deals', 'Music and Sports', 'DATA1', '54646465']);
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the info @migueltic. What I'm wondering is if I pass in the name attribute on my element and do as above - would this work?
I don't know what you mean exactly by the name attribute, but I guess it should work. Anyway, you can try it pretty easily with the Real Time reports in Google Analytics. It now includes a report for watching events in real time, including their parameters (category, action and label).
name attribute on the input...<input name="phone-number" type="text" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.