3
votes

Can't find the cohort dimension or the user acquisition date in the Dimensions and Metrics explorer to feed the data into the Google Script .gs (https://developers.google.com/analytics/devguides/reporting/core/dimsmets)

1

1 Answers

4
votes

You should try to use the dateOfSession<> segment notation:

segment=users::sequence::^ga:sessionCount==1;dateOfSession<>2014-05-20_2014-05-30;->>ga:sessionDurationBucket>600

The above segment will give you users who have had their first session between May 20, 2014 and May 30, 2014 and have spent > 600 seconds on the site.

Updated April, 2016

As of April 2016, with the release of Analytics Reporting API V4 it is now possible to create cohort reports by directly querying the API:

POST https://analyticsreporting.googleapis.com/v4/reports:batchGet
{
"reportRequests": [
        {
        "viewId": "XXXX",
        "dimensions": [
            {"name": "ga:cohort" },
            {"name": "ga:cohortNthWeek" }],
        "metrics": [
            {"expression": "ga:cohortActiveUsers"}
        ],
        "cohortGroup": {
            "cohorts": [{
                "name": "cohort 1",
                "type": "FIRST_VISIT_DATE",
                "dateRange": {
                    "startDate": "2015-08-01",
                    "endDate": "2015-09-01"
                }
            },
            {
                "name": "cohort 2",
                "type": "FIRST_VISIT_DATE",
                "dateRange": {
                    "startDate": "2015-07-01",
                    "end_date": "2015-08-01"
                }
            }],
        }
    }]
  }

The documentation contains samples in various languages.

It is important to note lifetime value queries ("lifetimeValue": True and all ga:acquisition... dimensions), as noted in the Analytics Help Center, can only be queried for App Views