How to use Google Analytics to track views of static HTML pages on file server? - google-analytics

I have set up a simple intranet at file:///c:/Path/Index.html and I'd like to track its use with Google Analytics.
Because its protocol is 'file:', not 'http:', it does not have a domain name. Is there a way to use Google Analytics anyway ?

If you turn on file auditing you can view access logs with that, but other than adding a web server app I can't see how this would work with google.

Any web page that is accessed locally, the cookies will be generated by Google Analytics and will not be recorded, simply because does not have a domain to be recorded.
If you want to measure your data in Google Analytics requires that your intranet is up and running within a Web Server.
Not being redirected to the Local Host but to a fictitious domain.

I was looking for information on implementing google analytics on static HTML, came across this official google info -
https://support.google.com/analytics/answer/1008080?hl=en
"Static website
A static website is one in which the page HTML is NOT generated using a programming language or interface such Python, Ruby, PHP, etc. To collect data, you must copy and paste the Analytics tracking code into the source code on every web page you wish to track.
Once you have the Javascript tracking code snippet for your property, copy the snippet exactly without editing it.
Paste your tracking code snippet (unaltered, in its entirety) before the closing tag on every web page on your site you wish to track.
If you wish to collect data from web pages to multiple properties at once, learn how to track a page using multiple accounts or properties."

Related

asp.net pulling external web page while preventing client from seeing requests

I'm facing a security issue where my users can see all url from where i pull content from,
I use a third party dashboard app with 4 html pages showing system status for each company .'www.xyz.com/dashboard/x.html'
I would like to create new 'aspx' file and display the 'x.html' inside as plain text , while preventing the user to see where the x.html is downloaded from , because he should not have access to the other 'html' files under the same domain.
here, the user should not see the xhr and where they come from
In other meaning , I need to create an asynchronous server side request that brings the 'x.html' and displaying it's content inside my aspx as it was my page.
Updated answer:
If you have an ASP.NET Dashboard app with multiple pages and you want to restrict access, you need to implement ASP.NET Identity role-based authorization so that your clients who login only have access to the areas of the site you want them to access.
On the other hand if you are trying to take someone else's HTML page and display it as your own, that goes against our community guidelines and you should instead consider openly redirecting your users to the proper page and giving credit where it's due.
Original answer: You can't do this, for two reasons:
The browser must know the target URL.
Obscuring the target URL would be a violation of basic security principles.
The <iframe> element requires a src attribute. See MDN for comprehensive documentation.

Tracking browser metrics inside desktop application

Our desktop application includes a pane which pulls content from a web page upon loading (think: links to what's new, top support topics, etc.). We have the analytics.js on that page.
We're getting demographic information back like country, which I assume is location-based. We also see language information. When using an embedded web page like this, where is Goolge Analytics getting the language information from? There isn't a way for customers to change language settings for the web part inside our application. We're trying to understand if the language information we're seeing is accurate or not.
Thanks in advance!
The language report is showing the default language set by a visitor on his/her web browser from which they are accessing your application.
Thanks.

Using Google Analytics to traking Chromium Embedded Framework (CEF) based desctop Application

If i developed a desktop application based on CEF (or Webkit). It mean that my GUI is HTML. Now i want take heatmap for my App. The smartest way is using Google Analytic as ga.js. But ga.js available only for public site with URL like http://*** Does anyone have idea how use GA js in local html?
In CEF you can serve content for any scheme using resource handlers. Use CefRegisterSchemeHandlerFactory() to register scheme handler for http scheme and custom domain eg. "myapp.foo". Files can reside on local drive and be accessible through http://myapp.foo/. There is a question whether GA validates this domain. Even if, then you could register scheme handler for a real domain that you own for ex. myapp.com. Content still can be served locally for that domain using resource handler.

Link to a specific section of a Silverlight app

I have a client that has a SilverLight app that contains all of their products. They are wanting to create HTML pages (now that they realized they aren't getting indexed in Google) for all of their products. On those pages they want a link to the silverlight app that will open a specific product.
I'm not a WPF developer, so I'm not sure what is possible. My first thought was maybe we can pass an id to the SilverLight app and then put some code in place to switch to the correct product.
Any ideas?
Thanks,
Cole
In the asp.net host application, you can read the parameters from the query string and pass them to the silverlight plugin in the InitParams section.
More info can be found here.
Ideally you want to detect that it is Google (or another search engine) hitting your site and direct the user/search to an appropriate page (Silverlight page for people and HTML pages for Search Engines).
Navigation in Silverlight uses bookmark URLs on a single page (like website.com/silverlightpage/#item=1234) whereas your site will likely use MVC mappings (like website.com/item/1234).
From a user-experience perspective you just want to click a result in Google and go straight to the Silverlight bookmark URL equivalent.
To do this you need to catch incoming URL requests in your web site, identify any search engines, and if it is a real person redirect them to the Silverlight app page (e.g. with item id passed into the bookmark).

Track Hits using Google Analytics and an ASP.NET web handler (ASHX) page

We are using Google Analytics for our site, but since it uses client script in HTML output we are unable to track hits to any of our ASP.NET ASHX handler pages.
Does anyone know of a way to do this?
follow this example and you should be good to go!
More info can be found here as well.
pageTracker._trackPageview("/handler.ashx");
It doesn't appear that the server API allows this.

Resources