2

Hi I'm wondering how Google Analytics (GA) knows whether people land on some file on my server. I have my GA tracking javascript code on our base url, example.com. I'm wondering how GA knows whether someone visits a file on my server, for example:

example.com/files/some.pdf

Does the default GA configuration, the javascript code you copy paste onto your index.html, register that people are looking at this PDF?

  • 1
    possible duplicate of How to track a download with Google Analytics? – Josh Mountain Jan 16 '15 at 16:09
  • 1
    @JoshMountain thanks. What if they just type the downloaded file into the browser bar? No GA code will be triggered in this case. This is the use case I'm more interested in. – tim peterson Jan 16 '15 at 16:17
  • 2
    As far as I know there is no way to track that using GA, you would probably need to use some sort of server-side logging like Awstats. – Josh Mountain Jan 16 '15 at 16:18
5

You need to add custom event tracking to your pages. Look at this link hope it helps.

Put your files behind a PHP,ASPX,CFG application page add the event tracking to the page your url should look something like page.php?file=name_of_file.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.