# Download Button Loses Functionality

**URL:** <https://forum.wixstudio.com/t/download-button-loses-functionality/7165>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [October 7, 2021, 6:40pm UTC](https://forum.wixstudio.com/t/download-button-loses-functionality/7165 "2021-10-07T18:40:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zfarnwh](https://avatars.discourse-cdn.com/v4/letter/z/48db29/32.png) [@zfarnwh](https://forum.wixstudio.com/u/zfarnwh)\
**Post date:** [October 7, 2021, 6:40pm UTC](https://forum.wixstudio.com/t/download-button-loses-functionality/7165/1 "2021-10-07T18:40:30Z")

</div>

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](http://wix.to/UcBnC-4)  
// Add your code for this event here:

```
wixWindow . trackEvent ( "CustomEvent" , { 
    event : "Document Download" , 
    eventCategory : "CastThyBurdenUponTheLord-Organ-downloads" , 
    eventAction : "downloads" , 
}); 

```

}
