Since I was embedding the Astronomy Calculator calculations (ASP.NET running on Windows) inside a Clear Sky Tonight web page (HTML on Linux), I wanted a way to track the number of people who ran the calculations. My long term goal is to convert the ASP.NET to a web service but in the short term, I figured I would just add Google Analytics now. So, I added the necessary code and waited a day to check my Google Analytics account. There was no results. I then remembered the new real-time feature and set up a test. If I went directly to the ASPX page, a visitor was recorded. However, nothing was recorded with iframe.
I started doing some research and Google Analytics mentioned that you have to modify the code for cross tracking multiple domains. However, I noticed that a visitor was recorded when using my iPhone. More research lead me to a figure out it was an Internet Explorer only issue related to P3P. I found P3P was a W3C privacy initiative. So, I started researching this and trying to add the necessary code but I still couldn’t get Google Analytics to work. I also found out that most web browsers don’t even look for P3P, except for IE. So, I embarked on a challenge to figure it out.
Cutting to the end, the solution was in two forum posting: http://stackoverflow.com/questions/3547449/iframes-google-analytics-cookies-p3p-rocket-science-mess-i-cant-figure and http://productforums.google.com/forum/#!topic/analytics/x9wSHHAsVGE. The solution was to add a custom HTTP header to my Windows hosting account.
Below are the articles I used in my research: