Unrecognized content type:text/html

463 views
Skip to first unread message

stephanos

unread,
Mar 10, 2011, 3:33:47 AM3/10/11
to google-analytics-api - GA Data Export API
For over one month I've been working on the frontend of my Google-
Analytics-API based application without (I think) changing anything in
my backend (where the queries are made).

This morning I start up my app and received this:
- Unrecognized content type:text/html

The query I used is this one:
https://www.google.com/analytics/feeds/datasources/ga/accounts/~all/webproperties/~all/profiles?max-results=1000&start-index=1

I'm just wondering where I should start looking for the cause? Is my
gdata-client-library not up to date? Was/is there maintenance/changes
on/in the API?

Cheers,
Stephanos

chris@shufflepoint

unread,
Mar 12, 2011, 9:35:07 PM3/12/11
to google-analytics...@googlegroups.com
If you've had added new accounts or web properties, the time to satisfy the query can increase non-linearly. Check that you aren't experiencing a timeout.

stephanos

unread,
Mar 13, 2011, 1:29:23 PM3/13/11
to google-analytics-api - GA Data Export API
Well, I've done neither of those things. And it wasn't a timeout since
the error "Unrecognized content type:text/html" came straight out.
Since it's been working again the last 2 days I don't really know what
caused it :-?

chris@shufflepoint

unread,
Mar 13, 2011, 10:46:05 PM3/13/11
to google-analytics...@googlegroups.com
Hey,

I just saw something similar. The account feed contains this HTML:

<p class="ga-maintenance-msg">Google Analytics reporting is currently undergoing maintenance and will be available shortly. Your site traffic is being logged and you.will be able to see the data after system maintenance has concluded.</p>

Nick

unread,
Mar 14, 2011, 1:06:55 AM3/14/11
to google-analytics...@googlegroups.com
Hey,

Right now we have 2 "account feeds."
- our legacy feed in the Data Export API
- our newer feed in the Management API

Can you clarify which is being effected?

If it's the latter, there is an ongoing thread in our Management API group....feel free to add more details.

Thanks,
-Nick

stephanos

unread,
Mar 14, 2011, 6:27:06 AM3/14/11
to google-analytics-api - GA Data Export API
Hm, now I even receive it for a regular query to the Export API:

Unrecognized content type:text/html in query
https://www.google.com/analytics/feeds/data?start-index=1&max-results=10000&ids=ga%3A23911343&dimensions=ga%3Adate%2Cga%3Akeyword&metrics=ga%3Avisits&start-date=2009-11-29&end-date=2010-04-16&filters=&segment=dynamic%3A%3Aga%3Akeyword%21%3D%28not+set%29%3Bga%3Akeyword%21%3D%28content+targeting%29%3Bga%3Avisitors%3E0&sort=ga%3Adate

Caused by: com.google.gdata.util.ParseException: Unrecognized content
type:text/html
at com.google.gdata.client.Service.parseResponseData(Service.java:
2136) ~[gdata-core-1.0.jar:1.41.5]
at com.google.gdata.client.Service.parseResponseData(Service.java:
2098) ~[gdata-core-1.0.jar:1.41.5]
at com.google.gdata.client.Service.getFeed(Service.java:1136) ~[gdata-
core-1.0.jar:1.41.5]

How did you read the result's content? - are you using the gdata-
client as well?

Nick

unread,
Mar 14, 2011, 5:43:15 PM3/14/11
to google-analytics...@googlegroups.com
Thanks,

Which version of the API are you using: 1 or 2?

-Nick

stephanos

unread,
Mar 14, 2011, 7:55:28 PM3/14/11
to google-analytics-api - GA Data Export API
Version 2 of the API and version 1.42.0 of the gdata-java-client.
I would print the resulting message but I think I can't force the
gdata-client to do that because it seems to throw the exception quite
early in the parsing process.

Here is the query in question again:
https://www.google.com/analytics/feeds/data?start-index=1&max-results=10000&ids=ga%3A23911343&dimensions=ga%3Adate%2Cga%3Akeyword&metrics=ga%3Avisits&start-date=2009-11-29&end-date=2010-04-16&filters=&segment=dynamic%3A%3Aga%3Akeyword%21%3D%28not+set%29%3Bga%3Akeyword%21%3D%28content+targeting%29%3Bga%3Avisitors%3E0&sort=ga%3Adate

It's the very first time for months that I receive this error and for
the last few days it was always and only this query that would throw
it.
Could the query be falsely formatted and Google is giving an according
html response?

Nick

unread,
Mar 14, 2011, 8:29:46 PM3/14/11
to google-analytics...@googlegroups.com
Hi,

Alright, so this is a bug we're going to fix.

Currently, advanced segments are only session based, so they shouldn't work with ga:visitors. This is consistent with the user Interface Custom Reporting feature and we'll be updating the docs accordingly.

Once updated, using the query above should return "400 - bad request" errors, with a message about a bad segment expression. This will simplify debugging.

-Nick

stephanos

unread,
Mar 14, 2011, 8:45:39 PM3/14/11
to google-analytics-api - GA Data Export API
Thank you very much!

Sage Arbor

unread,
Feb 15, 2013, 8:35:28 AM2/15/13
to google-analytics...@googlegroups.com
I have a similar but unresolved issue.  I am routinely getting the error:

Service error: CalendarApp: Unrecognized content type:text/html

when running a script ot populate a gcalendar from a gdoc spreadsheet.  Key points below :

* the calendar gets semi populated
* the breakpoint (where the calendar stops getting populated) appears to be random
* the incidence of this error has been increasing as the amount of data in teh spreadsheet to be copied has increased
* getting rid of a long free text field being copied into the description of the calendar has decreased incidence (I looked for special characters that could cause a break, but the random nature of the breakpoint does not suggest this, or that length is an issue, unless google is binning the data between cells in some dynamic way).

Below is the script that copies the data:

function calTest1() {
  //var sheet = SpreadsheetApp.getActiveSheet();
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("toCal");
  var startRow = 2;  // First row of data to process
  var numRows = sheet.getLastRow()-1;  //4;  // Number of rows to process
  var dataRange = sheet.getRange(startRow, 1, numRows, 13);
  var data = dataRange.getValues();
  var cal = CalendarApp.getCalendarsByName("COM-Curric-Cal")[0];
  for (i in data) {
    var row = data[i];
    //var courseNum = row[0];  // First column
    var courseNum = row[3];  // First column
    var discipline = row[1];       // Second column
    var lecturer = row[2];
    //var desc = row[0] + " - " + row[2]+ " \nCompetencies = " + row[12] ;
    var tpyeCLE = row[4];
    var sHrs = row[5];
    var fHrs = row[6];
    var tstart = row[7];
    var tstop = row[8];
    var loc = row[9];
    //cal.createEvent(courseNum, new Date(tstart), new Date(tstop), {description:desc});
    cal.createEvent(courseNum, new Date(tstart), new Date(tstop));
 }
}
Reply all
Reply to author
Forward
0 new messages