How to get Google Core Reporting Api ids Parameter Value

Google core reporting api used to get reporting data from Google Analytics. While building query for core api most important parameter is ids or tableId for building core api query.

Get apiQuery =
    .get(tableId,                  // Table Id.
        "2012-01-01",              // Start date.
        "2012-01-15",              // End date.
        "ga:visits")               // Metrics.

Finding value for ids or tableId parameter is not straight forward, but it can be found very easily using google analytics url. Just browser Google Analytics

For old version of application you can get very easily, use value if id parameter in query string.

For latest version Google Analytics application url is different

It is the number at the end of the URL starting with “p” letter