I am looking to trigger multiple inline OnClick events with just one click.
The first action is the Facebook share dialog box, which is working correctly.
However, the second action where {ga(...) }
triggers an event goal in Google (Universal) Analytics is not functioning properly. The goal is not being recorded in GA as expected.
<a
class="facebook-share"
href="#"
onclick="
window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),
'facebook-share-dialog',
'width=626,height=436');
return false;
ga('send', 'event', 'social share', 'facebook share', 'top button' );
">
Share on Facebook
</a>
Does anyone have a solution to ensure that both the FB share dialog pops up and the click is successfully tracked in GA?