views:

28

answers:

1

in google analytics, how do I get the site from the AccountEntry ?

looks like that if I do:

  • entry.getProperty("ga:accountName")
  • entry.getTitle().getPlainText()

I get it. but is this correct ? where is it documented ?

A: 

Have a look to XML account feed reference with all the data returned from the API.
Here a Java example that access all the important account feed information:

for (AccountEntry entry : accountFeed.getEntries()) {
    System.out.println(
      "\nWeb Property Id = " + entry.getProperty("ga:webPropertyId") +
      "\nAccount Name    = " + entry.getProperty("ga:accountName") +
      "\nAccount ID      = " + entry.getProperty("ga:accountId") +
      "\nProfile Name    = " + entry.getTitle().getPlainText() +
      "\nProfile ID      = " + entry.getProperty("ga:profileId") +
      "\nTable Id        = " + entry.getTableId().getValue() +
      "\nCurrency        = " + entry.getProperty("ga:currency") +
      "\nTimeZone        = " + entry.getProperty("ga:timezone") +
      (entry.hasCustomVariables() ? "\nThis profile has custom variables" : "") +
      (entry.hasGoals() ? "\nThis profile has goals" : ""));
  }

This is a sample result:

Web Property Id = UA-4276604-4
Account Name    = www.mainsite.net
Account ID      = 4246204
Profile Name    = www.systempuntoout.com
Profile ID      = 26084768
Table Id        = ga:26084768
Currency        = USD
TimeZone        = Europe/Rome

Use the following code to get the site as requested:

entry.getTitle().getPlainText()
systempuntoout
okay. but which one is the website ???
Chez
Updated..use getTitle().getPlainText().
systempuntoout