title: OnClick - Uncaught SyntaxError: Invalid or unexpected token
body: <p>I'm having trouble getting an OnClick event to send back to Google(Universal) Analytics.</p>
  
  <p>Here's the line in question:</p>
  
  <pre><code>&lt;a href= “link-to-asset-goes-here” onclick="ga(‘send’, ‘event’, ‘Button’, ‘Click’, ‘AllVisits_Free’, {‘NonInteraction’: 1});”&gt;
  </code></pre>
  
  <p>When I inspect with Chrome Dev tools, I'm seeing this error: "Uncaught SyntaxError: Invalid or unexpected token"</p>
  
  <p>When looking through other questions, I found this one:<a href="https://stackoverflow.com/questions/16704922/onclick-function-is-causing-uncaught-syntaxerror-unexpected-token-error">java - OnClick error</a></p>
  
  <p>Could it possibly be just escaping all the strings then? Like so:</p>
  
  <pre><code>&lt;a href= “link-to-asset-goes-here” onclick="ga(\‘send’\, \‘event’\, \‘Button’\, \‘Click’\, \‘AllVisits_Free’\, {\‘NonInteraction’\: 1});”&gt;
  </code></pre>
  
  <p>Would that cause any issues with the NonInteraction part of the code?</p>
  
  <p>Unfortunately I don't have access to test this live, and have to send each code revision over to the client each time, or I could just test different variations of code a lot easier.</p>
  
  <p>And just for reference, we're using the newest version of GA(Universal) analytics tracking code. When looking at the Real Time reports in GA, it's registering that I'm on the page, but events are not firing when clicking the link.</p>
  
  <p>Thanks!</p>