Tracking Downloads Via Google Analytics

Adam_Greenwood
New Member
1 0 0

Hi,

Does anyone know how to get the event tracking in google analytics to work for tracking downloads s an event.

The example URL is:

<a href=”pdfs/my-file.pdf” target=”_blank” onclick=”_gaq.push([‘_trackEvent’,’Download’,’PDF’,this.href]);”>Download my file</a>

But the error below i thrown back:

how-fast:1123 Uncaught ReferenceError: _gaq is not defined

    at HTMLAnchorElement.onclick (how-fast:1123)

Does anyone know how best to implement on Shopify without impacting the native Google Analytics.

Thanks

Adam

Replies 4 (4)
Konstantin2
New Member
26 0 0

Hello, Shopify community!

I also will be appreciated if someone described this in more details.

Thanks for helping!

 

 

imsarosha
New Member
37 0 0

Hi Adam and Konstantin,

I'm Sarosha from Aiva. Our app, Aiva Overlays can help you integrate an overlay with a downloadable asset directly with Google Analytics for FREE. Aiva features an easy integration and will track all file downloads to both your GA dashboard and in Aiva's Analytics tab. You can link your download in our builder by using the "Download a File" action. 

Please free to reach out if you have any questions ?

5x your website conversion today → Aiva For Shopify
ChristianL
New Member
14 0 0

Hello @Adam_Greenwood 

I am als trying to get download tracking to work in Shopify.

This is a tutorial how get implement tracking via Google Tag Manager.
(It is in German though. )
https://www.ebernickel.de/blog/download-tracking-google-analytics/#

But I can't seem to get it to work although I followed all the steps.
Not sure if has something to do with where Shopify stores pdf-files when you click although this solution just targets clicks and not the url.

Alexandru_Derev
Shopify Partner
86 3 22

Hi @ChristianL ,

 

as far as I know Shopify now exposes the functionality you need via the Google Tag Manager, but I'm not sure if this is something you need to configure on the store, or it is now universally available.

 

If your store has Google Tag Manager enabled, you can send custom events by calling the window.dataLayer.push function. Here is a guide from Google on how to do that - https://developers.google.com/tag-manager/devguide, but there are other available online as well. 

 

If your store uses only Google Analytics, and not Google Tag Manager you can use something along the lines of - https://developers.google.com/analytics/devguides/collection/analyticsjs/events , via window.ga(...) calls.

 

Alex Dereveanco | CMO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog