Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-03-17 03:30:35

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Canonical method for tracking file downloads in Google Analytics?

Hi!

I’m wondering if the friendly neighborhood Textpattern pros have any recommendation for tracking file downloads using Google’s Universal Analytics.

For the uninitiated, Google Analytics requires you to add JavaScript to your page template, for any page you want to track. The script executes in the browser when someone views a page, to send a message to Skynet Google about the page view.

But Textpattern pumps file downloads to the user without signaling an event in JavaScript or triggering a page view. Your server logs and Textpattern can both keep a record of the download, but Google Analytics is none the wiser.

I’ve found that you can configure Universal Analytics to notice when someone clicks on a file download link, but that only covers some of the downloads. We also get hits to files that have been directly linked on other websites, and some of our files are listed on the first page of search results for certain Google searches. These clickthroughs go untracked in Google Analytics.

I can’t be the only one using Google Analytics, and I imagine that others have already found some way to create a pageview when someone accesses a file via Textpattern’s file_download link. How do you do it? What are the best practices?

Thanks in advance for your insight!

Last edited by johnstephens (2015-03-17 03:31:23)

Offline

#2 2015-03-17 04:17:18

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Canonical method for tracking file downloads in Google Analytics?

You can use event tracking and add javascript events to your download links but that won’t help if the link lives on another site. Read the whole post Matt!

Pretty advanced but the Measurement Protocol API would let you create server side code to send data to analytics. The file download callback could be used in a plugin to post an event to Google Analytics.

Last edited by MattD (2015-03-17 05:13:41)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2015-03-18 00:01:14

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Canonical method for tracking file downloads in Google Analytics?

Feel free to try this plugin I created.

I didn’t get consistent results but I don’t use Google Analytics much. It should work according to the documentation and I did get some events created but I expected more.

Let me know how it goes or if you run into any issues.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

Board footer

Powered by FluxBB