Reputation: 11
I am new here and I am trying to do something theoretically simple but I am just not getting it right. I need to fire a DCM Floodlight tag on a click event. The issue I am having is that there is already a Google Analytics function wrapped in the href element so when I am testing the tag I am getting the GA tag to fire, but not the Floodlight. The below is what I am using
<a href="http://www.iac2017.org/site/DefaultSite/filesystem/documents/IAC-2017-Registration-Brochure-2017.pdf" target="_blank" class="button" onclick="ga('send', 'event', 'Document', 'Download', ''); onclick="Registration brochure('land01','iac_f000','testu1');">DOWNLOAD REGISTRATION BROCHURE</a>
Do you guys see anything wrong with my syntax?
Aprreciate your help
Upvotes: 1
Views: 827
Reputation: 396
Instead of adding another onclick
attribute, you need to combine both function calls within the same attribute, like so:
<a href="http://www.iac2017.org/[...]/IAC-2017-Registration-Brochure-2017.pdf"
target="_blank" class="button"
onclick="ga('send', 'event', 'Document', 'Download', ''); brochure('land01','iac_f000','testu1');">
DOWNLOAD REGISTRATION BROCHURE
</a>
Note: I've put this on multiple lines just for readability, it is fine to have it as one line.
I'm assuming here that the function you're trying to call for the brochure is called brochure()
and not somehow Registration brochure()
, as spaces don't work within function names.
Also, I'd like to mention that using onclick
attributes for JavaScript is generally not encouraged any more. It's better to use DOM event listeners to separate JavaScript from the HTML, an approach named Unobtrusive JavaScript.
Upvotes: 2