x

Google Events Tracking for pdf File

Hi Adam and/or Weebly Community,

Thanks in advance for your comments.

For context, I already have basic GA installed on my web site and am not a coder. 

  • Have a pdf file on a Weebly page and would like to add GA Event tracking to determine number of downloads 
  • Read everything I could find in a google search for GA Event tracking and Weebly, still unclear how to do

Found GA Event tracking code generator* on net that says to then: Place the following code within the code of your download link:   

onClick="ga('send', 'event', { eventCategory: 'download', eventAction: 'click', eventLabel: 'Catherines Self Discovery Map'});"

  • Not sure where to position the code since I can't get at link code in Weebly! 

Does anyone know how and where to add this Event Tracking code or if not, a workaround that results in tracking number of pdf downloads?

Thank you!

Catherine

*https://raventools.com/marketing-reports/google-analytics/event-tracking/file-download/

in case someone may find this helpful.

761 Views
Message 1 of 4
Report
3 REPLIES 3
Square

Assuming you've already added Google analytics to your site, you'll basically have to create your link with the embed code element for this to work. What you'll want to do is right-click your link and copy the URL fo the file, then use it with something like this in an Embed Code element:

<a href="INSERT-FILE-URL-HERE" onClick="ga('send', 'event', { eventCategory: 'download', eventAction: 'click', eventLabel: 'Catherines Self Discovery Map'});">LINK TEXT HERE</a>
754 Views
Message 2 of 4
Report

Thank you.

In case this helps someone else, here are steps I used:

1. create text link for doc I want people to be able to download and publish site

2. right click on live link to get link address and copy for reference

3. put "embed code" where you want it on weebly page

4. use code Adam referenced in prior response and insert your link address info there

5. publish and test

6. Weebly glitch workaround: When I deleted the text link in favor of the embed code link, I would get a 404 for my file download with just the embed code on the page. When I added the text link back in, the embed code worked fine. To offset the double links, I put the info in a grey box and selected the lightest color grey for the text link, thereby camoflauging it, so you only see the "Download File" link that works with the embed code.

Try Google Advertiser Community for more info.

736 Views
Message 2 of 4
Report
Square

Thanks for sharing that, @Daisy22!

733 Views
Message 2 of 4
Report