Adding code to a download button breaks the ability to download/view the file

Question:
[We need help on the backend to manage our members section and downloads. I’ve got the pdfs in our media files now. Anyone can download after signing up. That’s not the issue. The issue is once we add the code we need to track downloads and catch the member’s info, the ability to download the pdf breaks. We need help; our site goes live in 2 days and this is a major issue for us. ]

Product:
[Which editor or feature is your question most relevant to? e.g. Wix Editor, Wix Studio Editor.]

What are you trying to achieve:
[Explain the details of what you are trying to achieve. The more details you provide, the easier it is to understand what you need.]

What have you already tried:
[Share resources, forum topics, articles, or tutorials you’ve already used to try and answer your question.]

Additional information:
[Include any other pertinent details or information that might be helpful for people to know when trying to answer your question.]

Perhaps this would help Download Files | Velo