Google Analytics - tracking somePage.exe pages - google-analytics

If I have my server setup to serve up pages with .exe extension as html content, and I put standard GA tracking code (javascript) onto my page, will GA reject hits to that page, since it's a .exe extension?
I am asking because .exe files are traditionally tracked as downloads by tracking tools...
...so has anybody had experience with putting GA on .exe files served up as web pages?

If the .exe renders HTML and executes the GA tracking code, then it should appear in your Content Reports after the customary 24-48 hrs. Unsure if there are any restrictions for .exe files on the GA side (I would venture that there aren't any), but give it a try in a test profile and see what you get.
HTH,
KM

Related

How to minify Google Tag Manager

Google Tag Manager (GTM) minifies all tags and snippets and serves them minified. Which is good.
But the javascript that loads the tags itself is not minimized.
For example: https://www.googletagmanager.com/gtm.js?id=GTM-WPGCQNW
// Copyright 2012 Google Inc. All rights reserved.
(function(w,g){w[g]=w[g]||{};w[g].e=function(s){return eval(s);};})(window,'google_tag_manager');(function(){
var data = {
"resource": {
"version":"137",
"macros":[{
"function":"__jsm",
"vtp_javascript":["template","(function(){var a=new Date(document.querySelector('meta[name\\x3d\"article_date_original\"]').content);return a.toISOString()})();"]
...
Here you see that the total javascript is not minified, but the contents of each line is minified.
My question is, might there be an answer to it: how can I link to a minified version? Does Google offer this as well?
Google does not offer this.
Since the GTM file does not need a backchannel (it is pure Javascript) you could download it to your server, minify it there and link the resulting file in your website (by "download" I mean something like a proxy that downloads and minifies on the fly, or in prescribed intervals, in order to alway receive the lastest version of the GTM file).
It is of course possible that further minification will break the file. Also since the file is delivered gzipped to the browser, and a bunch of spaces compress pretty well, it is unlikely that further minification will have a big effect (you would need to see that your own server zips the file again before it is delivered to your site, or you just make things worse).
I do not think this is actually a worthwhile idea, but it is basically the only way to minify the file beyond what Google does for you.

How to track a PDF view (not click) on my website using Google Tag Manager

How can I track that someone visited the following URL of my website http://www.website.com/mypdf.pdf.
I tried using a Page View trigger on a Page View tag. I'm completely new at Google Analytics so not sure how to proceed. Most people are going to be going to that pdf directly via URL, as there is no link to it on my website, but I really want to be able to track how many people view it.
Thanks in advance!
You cannot track PDF views with the help of GTM. GTM for web is a javascript injector, and one cannot inject Javascript into a PDF document from the browser.
One way to circumvent this is to have a gateway page, i.e. have the click go to a HTML page that counts the view before redirecting to the document in question (naturally you could use GTM in that page). Since people go directly to the PDF URL this would require a bit of scripting - you would have to redirect all PDF links to your gateway page via a server directive, count the view and then have the page load the respective document.
Another even more roundabout way would be to parse your server log files and send PDF requests to GA via the measurement protocol (actually many servers allow to have log writes redirected to another script, so you could do this in realtime). I would not really recommend that approach - it's technologically interesting, but probably more effort than it is worth.
The short version is, if you are not comfortable fiddling a little with your server setup you will probably not be able to track pdf views. GTM does not work on PDF files.
Facing same issue…
My solution was to use url shortener (like bitly.com) which includes opening statistics.
Not the perfect solution but it works for direct pdf access from external source (outside your site).

Google Analytics Receiving Data -- but no analytics in view source

My client created a website and a google analytics account. The report indicates that the account is receiving data -- and yet, when we do a view-source of the pages of the site, there is definitely absolutely no analytics code there. How is this posssible?
It is possible that the Analytics code is added via Javascript, not appearing in the "View Source" page. It is also possible for it not to appear in the inspector either.
I do not know how this happens, but I have encountered scripts that exist and run although they are not displayed in either the source page or the live DOM inspector (in Google Chrome). This happened to me while loading a PHP template containing Javascript through an Ajax request.
If you have access to the source code of your website, search the entire project for for the Analytics ID (Here's how to find it: https://support.google.com/analytics/answer/1032385?hl=en), and you'll locate your tracking code.
If your project is running on a Linux server, here's a post about how to quickly find a keyword (like the Analytics ID) in a folder: How do I find all files containing specific text on Linux?

Google PageSpeed Insights show unidentified scripts in results

I am testing my home page (http://stayuncle.com/home) speed at Google PageSpeed Insights. In result, I am getting few unidentified java script. I have no idea how they get into the results.
Can someone help me to understand how they get into result?
If you open up a network tab and view the results when the page loads you will see that those scripts load with the page. This script isn't coming from Google PageSpeed, but rather from your own site. It seems to be coming from a metrics script and is pushing mixpanel results.
This is the URL inside the script.
http://popcornmetrics.com/legal
Unfortunately, I am not able to see what initiated the script. You might want to go through each of your JavaScript files and check if it isn't loaded from there!
What you're seeing is PopcornMetrics script and library installed in your website (http://stayuncle.com/home). Our new library has a minified and gzipped version which will show better results in Google PageSpeed.

Tracking File Downloads with Google Analytics

I have an html file that gets loaded when a user connects a flash drive to their PC. That HTML contains a direct link to a PDF on our server. (They don't want to put the PDF on the drive for some reason) Anyway, I'm trying to figure out how to track how many times this PDF is accessed from one of these drives.
Since the user is being taken directly to the file and not a landing page, is there a way I can attach analytics to the link that directs the user to the file? I was thinking a Virtual Page View would work but I don't understand exactly how GA would be getting that data.
Can anyone help demystify this?
GA needs to run javascript. PDFs will not invoke a call to GA when hit directly from search results, emails, or flash drives.
You might be able to track it by creating a rewrite rule on your server to a page that runs the GA code then loads the PDF on that page.
I had a similar feature on my site and it worked well except that while tracking the PDFs, the page that loaded the PDF was inflating my pageviews numbers. I didn't want PDF's to be mixed in with pageviews because it confused the client who had been used to separating the two. I created a filter for the PDF 'calling' page and the pageview number settled back down.
I ended up removing this method and falling back to the server logs for PDF downloads and GA for everything else.
GA is a javascript tracker. Plain and simple.
The issue is not the JavaScript, since you can include that locally, but the fact that GA won't work on HTML loaded from a filesystem.
The landing page can be built so that it automatically triggers the download and GA while that happens. Pageviews won't be an issue, since downloads should be tracked as events anyway.
You can attach a javascript function to the link and have it track the page view with Google Analytics
Check this out for more.
It's an easy way to track any file download on a website.

Resources