I am trying to track a user logging in with GA. I have my custom_var code occuring onClick of the login button.
<input type="submit" formtarget="_blank" onClick="_gaq.push(['_setCustomVar', 1, 'Users Login', '$("#user_login").val());', 3]);"/>
"#user_login" is the field containing the information I need passed.
I am using the formtarget attribute to open in a new window. This was after thinking that maybe the onClick event was not running before the page was being redirected.
This custom event is not being tracked when I log in to the account, but page views are. At first, I thought there was an issue with my code, so I tried tracking a regular event on click of an anchor:
<a href="/about-us/about-discovery-capital/" onclick="_gaq.push(['_trackEvent', 'Testing', 'Click', 'About']);">About</a>
The same issue occured, page views are fine, but the event is not tracking.
- The GA code that I am using is up to date and in the correct place.
- The site is password protected, but as the page views are being tracked I dont see this as an issue.
- I have run the GA debugger chrome extention, but I am getting no errors
Unfortunately due to the client, I cannot provide the website.
If you could shed light on what possible reasons there could be for page views tracking, but not events, would be a great help!
Cheers