Peter Bushnell
Peter Bushnell

Reputation: 938

Google Analytics Button Tracking

In Google Analytics I have set up a Goal for a button to be pressed on a sign up contact form. It is to collect email addresses for a mailing list. The problem is that it does not work. I have followed three guides on this offering slightly different code for alternate approaches but have not got it to work.

In GA the Goal is setup as follow...

Goal setup: Custom
Name: Contact
Type: Event
Category Equals to Contact
Action Equals to signup

GA is tracking the page and analytics from users can be viewed so we can see it is working. We are using CloudFlare and GA is added on the fly to all pages served through their cloud.

The code for the button is below.

<button type="submit" onclick=”_gaq.push([‘_trackEvent’, ‘Contact’, ’signup’])” class="btn btn-success">Sign up</button>

Any help on this would be appreciated.

Upvotes: 1

Views: 136

Answers (1)

nyuen
nyuen

Reputation: 8907

If that is the exact code you are using for the button, then at least you would need to change the smart quotes (ie. the angled quotes) to straight quotes, so it should look like this:

<button type="submit" onclick="_gaq.push(['_trackEvent', 'Contact', 'signup'])" class="btn btn-success">Sign up</button>

I believe there are issues when the smart quotes are used.

Upvotes: 1

Related Questions