I set up a page for a client that posts a lot of research in PDFs. I’d like to set up Google Analytics to track the number of downloads for each PDF. I followed the instructions on this video to the letter. I add a button, it works fine. I add the code to track clicks on the button. Then, when I click the button on the live site, it shows up in Realtime analytics, but it doesn’t actually trigger a download. I notice others have had this problem here:
https://www.wix.com/corvid/forum/community-discussion/is-there-a-way-to-get-a-number-on-downloads
but I couldn’t find a resolution. Here’s the code I added:
import wixWindow from ‘wix-window’ ;
export function mybutton_click(event) {
wixWindow.trackEvent( “CustomEvent” , {
event: “Funnel” ,
eventCategory: “PDFdownload” ,
eventAction: “Downloads” ,
eventLabel: event.target.label,
})
}
Any ideas what I’m doing wrong? Also if this works, may I ask if Google Analytics will track events for longer periods of time? Realtime will keep a running 30 minute count, but could I use this to find out all-time number of downloads? Thanks!