title: How do I add an onClick event to a link generated on PHP?
body: <p>I am trying to add an onclick event on a link in a PHP file. </p>
  
  <pre><code>$body2 .= '&lt;td class="sampling-list-td download-link"&gt;' . '&lt;a ' . 'class="sampling-list-download" ' . 'href="#" ' . 'data-id="' . $assetId . '" ' . 'data-type="' . $assetType . '" ' . 'data-event="LogFileElaboration" ' . 'data-file="' . $fileName . '" ' . 'data-enterprise="' . $provisionedBuId . '"' . '&gt;'
                  . '&lt;i class="glyphicon glyphicon-download-alt" style="color: rgb(109, 110, 113); zoom: 1.3;"&gt;&lt;/i&gt;'
                      . '&lt;/a&gt;' . '&lt;/td&gt;';
  </code></pre>
  
  <p>This is what I'm trying to do:</p>
  
  <pre><code> $body2 .= '&lt;td class="sampling-list-download" ' . 'onClick="ga('send', 'event', { eventCategory: 'download', eventAction: 'click', eventLabel: 'Files Download'});" ' . 'href="#" ' . 'data-id="' . $assetId . '" ' . 'data-type="' . $assetType . '" ' . 'data-event="LogFileElaboration" ' . 'data-file="' . $fileName . '" ' . 'data-enterprise="' . $provisionedBuId . '"' . '&gt;'
                  . '&lt;i class="glyphicon glyphicon-download-alt" style="color: rgb(109, 110, 113); zoom: 1.3;"&gt;&lt;/i&gt;'
                      . '&lt;/a&gt;' . '&lt;/td&gt;';
  </code></pre>
  
  <p>But I am getting the following errors:</p>
  
  <p><strong>ParseError: syntax error, unexpected 'send' (T_STRING)</strong> </p>
  
  <p>I don't know what i'm doing wrong? I'm trying to add the event tracking code for google analytics T_T </p>