Creating A File Download Page And Setting Up A File Download Event In Google Analytics

Creating A File Download Page And Setting Up A File Download Event In Google Analytics


arnold on Nov 03, 2018

Creating A Page And Uploading A PDF

This guide is written from my MBA digital marketing students. You will first create a page on your website where you can place a PDF for your fictional customers to download. Then we will set up the code to track the download event and we will confirm it is working in our real-time analytics.

To start, get signed into your website and go to your dashboard.  (

To create a new page click the + NEW at the top of the page and then click PAGE.

Give your page a title and add some text. In the example below I change the first line of my text to H1 and the second to an H2 so it looks a little better when we publish the page. To change the font to a header (H1 or H2) hover over the text and click the “paragraph” option and change it to a heading.

How To Create A New Page In WordPress

We will then need to add a PDF to the page.  Click the “Add Media” button as shown below.

How To Add A PDF To A WordPress Page

Then click Select File and navigate to the PDF on your computer and select itand click “Open”.  If you need the PDF to play with you can download it here: Lawn Care Schedule.

How To Add A PDF To A WordPress Page

Once the File is selected you will see a screen that looks like this:

WordPress Page File Upload

Click “Insert Into Page” in the bottom right.

You should have a page that looks similar to this:

WordPress Page File Upload

You can publish the page if you want and take a look at it or just continue on with these instructions.

Setting Up The Download Tracking Event In Google Analytics

What we are interested in learning in this tutorial is how to set up an event that tracks downloads. There are several different ways you could set this up.

Since we only have one file that needs to be tracked, for this tutorial we will go ahead and manually tag the link with a little help from a program called RAVEN.

Go to:

Then Click on File Download

File Download Raven Tools

Fill out the form as I did or use your own terminology:

Using Raven Tools To Tag A Link As An Event

Once you get it filled out copy the first set of code as indicated by #4 above.

My code looks like this: onClick=”ga(‘send’, ‘event’, { eventCategory: ‘download’, eventAction: ‘click’, eventLabel: ‘lawn_care_schedule’});”

The URL of my PDF looks like this:

I need to combine these. To do this I am going to go into my website page editor and select “text” so that I can edit the html of the page post.

Accessing The Text Editor In The WordPress Editor

This is where you can add your tracking code to your URL. Take a look at the image below to see how I combined these. Do the same for yours and save your page.

Tagging A Link In The WordPress Text Editor To Track An Event

You are now able to track downloads of your PDF.

How To Test Your Event To See If It Worked

We now want to test our event to see if it works. To do this is simple. We just need to check the events section of our real-time results in Google Analytics and trigger a download.

First open up an incognito browser. To do so on chrome follow the steps in the image below:

Putting your browser into incognito mode

Load the page of your website that has the download button on it.

Then go to your Google Analytics and go to your real time results.  Click on Events as shown below.  Make sure you can see yourself in the real time results and then click download on your PDF in your website.  You should see this:

Checking your event in your real time results

If you can see the event then you set it up correctly.  The last thing I am going to do is set this up as a goal so I can count it as a conversion in my analytics. To do this go to your goals in your analytics and set up a custom event goal as shown in the image below:

Steps To Set Up A Download Goal In Google Analytics

Make sure that the CATEGORY, ACTION and LABEL of the event all match the goal. Click Save and you should see this:

Steps To Set Up A Download Goal In Google Analytics

Now go to your real time results and click CONVERSIONS this time. Open up an incognito browser again and download the file once more.  You will now see the download register as a conversion.

Checking Your Real Time Download Conversions In Google Analytics


The Ultimate