# {solved} Button: Tracking & Downloading works not together

**URL:** <https://forum.wixstudio.com/t/solved-button-tracking-downloading-works-not-together/27490>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [November 11, 2020, 10:00am UTC](https://forum.wixstudio.com/t/solved-button-tracking-downloading-works-not-together/27490 "2020-11-11T10:00:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkulanga](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mkulanga/32/24751_2.png) [@mkulanga](https://forum.wixstudio.com/u/mkulanga)\
**Post date:** [November 11, 2020, 10:00am UTC](https://forum.wixstudio.com/t/solved-button-tracking-downloading-works-not-together/27490/1 "2020-11-11T10:00:37Z")

</div>

If you have a download button and would like to track the downloads, there is a beautiful wix guide how to do it

[![](https://us1.discourse-cdn.com/wix/original/3X/b/8/b8d8c66e8dae395544b4bf291f3e49b8318bfbdf.jpeg "How to Use Wix Code with Marketing Tools to Create Custom Events") ](https://www.youtube.com/watch?v=MTBVyk0YGv0)

Unfortunately the download button stops working , because you are overriding the default href behavior with on\_click event. And there is only the tracking code for google analytics.

If you would like to download the file too, you have to use  
_wixLocation.to(_ _“[https://your-link-to-file](https://your-link-to-file)”_ _);_  
after your tracking code. This is not shown in the video!

Unfortunately this link opens in the same window, because wixLocation.to() does not accept any specification where to open the link.

Wix does not allow to use the native javascript function _window._ _open_ _(_ _“[https://your-link-to-file](https://your-link-to-file)”_ _)_ which opens the URL by default in a new window.

**So dear WIX Team, can you provide us with a better solution, so our links can open properly in a new window?**

Best regards,  
Miroslav

---

<div class="post-metadata">

**Author:** ![mkulanga](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mkulanga/32/24751_2.png) [@mkulanga](https://forum.wixstudio.com/u/mkulanga)\
**Post date:** [November 11, 2020, 12:53pm UTC](https://forum.wixstudio.com/t/solved-button-tracking-downloading-works-not-together/27490/2 "2020-11-11T12:53:49Z")

</div>

## I have found a simple and cute workaround:

Don’t use Button. Instead use a picture of the same button e.g. as a vector graphic in SVG. Then link it to a document and add onclick event only with the tracking code. It works like a charm. Enjoy 😍
