user1669039
user1669039

Reputation: 5

javascript google analytics event tracking error

Can someone look at my syntax? I think I have something wrong here:

    html += '<center><a class="customerReviews" href="'+data[x].url+'#customerReviews" onClick="ga('['_trackEvent', 'marv1', 'cardv1', 'customerReviews']');"><hr/>Click to Read card reviews</a></center>';

This is being inserted in a JS file.

Upvotes: 0

Views: 56

Answers (1)

Papa
Papa

Reputation: 1638

You have an extra set of single quotes around the parameters.

onClick="ga(['_trackEvent', 'marv1', 'cardv1', 'customerReviews'])">

Upvotes: 1

Related Questions