Track PDF files downloaded from my site
-
I came across this code for tracking PDF files
[1. map.pdf ( name of PDF file ) and files is the folder name. Am i right ?
2. What shall i be able to track using the code given above ?
a ) No. of clicks on links or how many persons downloaded the PDF files ?
3. Where in Google this report will be visible ?
Thanks a lot.](http://www.example.com/files/map.pdf)
-
Hi Atul, Following is the response to your queries. 1). 'Map.pdf' refers to the name of the pdf and 'file' refers to the directory in which it is stored. 2). Using the above code, you would be able to track the click on the links and not the downloads. For setting up event tracking for a pdf download, I would recommend you to place the following code within the code of your download link onClick="_gaq.push(['_trackEvent', 'download', 'Pdf', 'Mypdfname',, true]);" Thus, the final download link would look like Download PDF Now that you have set up event tracking script in place, you now need to set up the event as a goal in Google Analytics. For that, follow the steps, 1. Open up the profile you wish to set up the goal in. 2. Click the gear icon in the upper right corner of the Google Analytics interface. 3. Click the Goals tab (in the sub-navigation just below where your Profile is listed) 4. Choose the Goal Set you wish to add the event to. 5. Name your goal and select the Event radio button. 6. Populate the following goal details: Category | that matches | download Action | that matches | Pdf Label | that matches | Mypdfname Value | that matches | 7. If you’ve added a Value in step 1, leave the “Use the actual Event Value” radio button selected. 8. Click “Save” and you’re ready to go! Hope, it might help! Cheers!
-
I doesn't. It does you a number of views, because there's a lot different solutions in internet browsers and plugins and user can even view it in Google docs viewer. But for many purposes it is sufficient to know that user view a document.
You can implement dedicated java script tool to know the number of downloads. Probably the code mentioned by nvs.nim (below) realizes such an action.
Good luck
-
Thanks.
Does the code gives me the number of downloads
how many persons have downloaded the PDF file or
how many times PDF file was downloaded.
-
Hi,
ad. 1it's part of url - address of file you have on serwer (to download) obviously it's example you can named it different
ad. 2 it's optional - look to my answer on 31/01 and you can read it on google WT help
Marek
-
Ok. Let me be very specific
You gave me the code -
[1. What does files/map.pdf means ?
2. Is label MyMap necessary or i can omit it
Thanks a lot for your patience :)](http://www.example.com/files/map.pdf)
-
Hi again,
First you should decide about tracking method. Next read Google article and finally ask us a specific not general question. I think it is fair advise
-
I am still not sure about the EXACT code. Can you please give me the code to track how many persons have downloaded PDF files from a site.
I will appeciate greatly
-
Hi Atul,
Did this answer your question, or do you still have questions about this topic?
-
Hi Steve,
Could you please tell me how? What specific technical solution you use?
Thanks, Marek
-
We track our PDF downloads via content. This way, we know how many of each particular one were downloaded.
-
It does not look right cos it was a virtual pageview tracking or mixture of both methods.
_trackPageview() creates a virtual directory structures and _trackEvent() creates an event...
-
Hi,
I think that it's better to use event tracking than virtual page-view tracking.
Syntax and parameters explanation
_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)'```
[]);">Download](#)where: -category (required) - e.g. Maps (The name you supply for the group of objects you want to track.) - action (required) - e.g. Download (A string that is uniquely paired with each category, and commonly used to define the type of user interaction for the web object.) - label (optional) - e.g. EuropeMap or filename map.pdf (An optional string to provide additional dimensions to the event data.) - value (optional) - An integer that you can use to provide numerical data about the user event. It is very complicated to quick explanation and usage, you should read full article and additions like: Implicit Count. - non-interaction (optional) - set it for "true" (A boolean that when set to `true`, indicates that the event hit will not be used in bounce-rate calculation.) In this link you can read full google help article: http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html In your case syntax will be: [](http://www.example.com/files/map.pdf) [Then go to analytics to "Content" section of the reports and view Event Tracking an you will have: category: PDF Action: Download label: MyMap and count .... count how many events you have Wish you a huge number of downloads. M.](http://www.example.com/files/map.pdf)
-
Using this code will track all the files you offer to download: /** * Measuring GA Files */ var extensions = ['pdf','doc','docx','xls','csv','jpg','gif', 'mp3','swf','txt','ppt','zip','gz','dmg','xml']; var download_ga_folder = '/downloads/'; $('a').each(function(){ var _self = $(this); var u = $(this).attr('href'); if(typeof(u) != 'undefined'){ if(u.indexOf("?")!=-1){ uext = u.substring(0, u.lastIndexOf("?")); }else{ uext = u; }; var ext = uext.split('.')[uext.split('.').length - 1]; //check extensions for(i = 0; i < extensions.length; i++){ if(ext == extensions[i]){ _self.click(function(){ pageTracker._trackPageview(download_ga_folder + _self.attr('href')); return false; }); break; }; }; }; });
-
HI Aful,
Your event tracking anatomy does not look righ to me. Go here to see how to structure it correctly:
http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html#AnatomyReagrding where the data should render in Google Anlytics go to Content sub category events ,
Good luck!
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Site Migration Questions
Hello everyone, We are in the process of going from a .net to a .com and we have also done a complete site redesign as well as refreshed all of our content. I know it is generally ideal to not do all of this at once but I have no control over that part. I have a few questions and would like any input on avoiding losing rankings and traffic. One of my first concerns is that we have done away with some of our higher ranking pages and combined them into one parallax scrolling page. Basically, instead of having a product page for each product they are now all on one page. This of course has made some difficulty because search terms we were using for the individual pages no longer apply. My next concern is that we are adding keywords to the ends of our urls in attempt to raise rankings. So an example: website.com/product/product-name/keywords-for-product if a customer deletes keywords-for-product they end up being re-directed back to the page again. Since the keywords cannot be removed is a redirect the best way to handle this? Would a canonical tag be better? I'm trying to avoid duplicate content since my request to remove the keywords in urls was denied. Also when a customer deletes everything but website.com/product/ it goes to the home page and the url turns to website.com/product/#. Will those pages with # at the end be indexed separately or does google ignore that? Lastly, how can I determine what kind of loss in traffic we are looking at upon launch? I know some is to be expected but I want to avoid it as much as I can so any advice for this migration would be greatly appreciated.
Technical SEO | | Sika220 -
Deindexed site - is it best to start over?
A potential client's website has been deindexed from Google. We'd be completely redesigning his site with all new content. Would it be best to purchase a new url and redirect the old deindexed site to the new one, or try stick with the old domain?
Technical SEO | | WillWatrous0 -
Site Ranking Ahead of Us - Why?
I don't want to give details, but a competitor's site ranks ahead of us by a spot or 2 for some of our major keywords, and we can't figure out why. We have more content indexed, we have better content (my opinion), we're better optimized, we have significantly better MozRank and Majestic rankings, we have more links, we have better links. They have a plain Jane Wordpress blog, and their pages don't even have 300 characters. They don't have any awesome links. There are plenty of other sites besides ours that should outrank them. When I am using the various tools at my disposal, I can see why a competitor outranks us. I'm not obsessing, but this one, I just don't understand. Has anyone had this experience?
Technical SEO | | CsmBill0 -
Cross links between sites
hi, We have several ecommerce sites and we cross linked 3 of them by mistake. We realize that the sites were linked through WMT, We have shut down 2 of the sites about 2 months ago, but WMT still shows the links coming from those 2 sites. how do we make sure that google will see the sites are shut down. Is there a better of way resolving this issue. We are no longer using those sites, so do not need them to be active. whats the best solution to show google that the links are no longer there. Crawler shows that it was able to crawl the site 45 days after it is shut down. thanks nick
Technical SEO | | orion680 -
Should Canonical be used if your site does not have any duplicate
Should canonical be used site wide even if my site is solid no duplicate content is generated. please explain your answer
Technical SEO | | ciznerguy0 -
Converting files from .html to .php or editing .htaccess file
Good day all, I have a bunch of files that are .html and I want to add some .php to them. It seems my 2 options are Convert .html to .php and 301 redirect or add this line of code to my .htaccess file and keep all files that are .html as .html AddType application/x-httpd-php .html My gut is that the 2nd way is better so as not alter any SEO rankings, but wanted to see if anybody had any experience with this line of code in their .htaccess file as definitely don't wan to mess up my entire site 🙂 Thanks for any help! John
Technical SEO | | JohnHerrigel0 -
Site Architecture Trade Off
Hi All I'm looking for some feedback regarding a site architecture issue I'm having with a client. They are about to enter a re-design and as such we're restructuring the site URLs and amending/ adding pages. At the moment they have ranked well off the back of original PPC landing pages that were added onto the site, such as www.company.com/service1, www.company.com/service2, etc The developer, from a developer point of view wished to create a logical site architecture with multiple levels of directories etc. I've suggested this probably isn't the best way to go, especially as the site isn't that large (200-300 pages) and that the key pages we're looking to rank should be as high up the architecture as we can make them, and that this amendment could hurt their current high rankings. It looks like the trade off may be that the client is willing to let some pages be restructured so for example, www.company.com/category/sub-category/service would be www.company.com/service. However, although from a page basis this might be a solution, is there a drawback to having this in place for only a few pages rather than sitewide? I'm just wondering if these pages might stick out like a sore thumb to Google.
Technical SEO | | PerchDigital1 -
UK and USA site versions
We have a UK site selling our product and we are due to appoint a reseller in the USA, they require a .com domain, which makes sense and they also would like to see American spellings etc and currency. also we feature heavily in pubs and they want this referred to as "bars" so there are a few tweaks here and there but mainly just slight variations on spelling and terminology. These are only minor adjustments to our current site, what is the best way of achieving this without falling foul of duplicate content issues.
Technical SEO | | IPIM0