I am trying to count number of times a download button is clicked for use in Google Analytics. My issue is when I add the onClick event handler, the download functionality of the button is blocked, nothing downloads. The button is not connected to a dataset. I am linking it in the onReady function. Download works fine until I add the onClick event handler to try to capture the count. Below is sample. Thanks.
$w . onReady ( function (){
$w ( “#CastThyBurdenUponTheLordOrganButton” ). link = “wix:document://v1/ugd/5f5a09_c66dd1ccab7247b8afc67f23aa3978df.pdf/Cast%20Thy%20Burden%20upon%20the%20Lord,%20Organ%20Prelude%20-%20Full%20Score.pdf” ;
});
import wixWindow from ‘wix-window’ ;
/**
- Adds an event handler that runs when the element is clicked.
- @param {$w.MouseEvent} event
*/
export function CastThyBurdenUponTheLordOrganButton_click ( event ) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
wixWindow . trackEvent ( "CustomEvent" , {
event : "Document Download" ,
eventCategory : "CastThyBurdenUponTheLord-Organ-downloads" ,
eventAction : "downloads" ,
});
}