/** * Google Analytics Node - Version 2 * Discriminator: resource=report, operation=get */ interface Credentials { googleAnalyticsOAuth2: CredentialReference; } /** Return the analytics data */ export type GoogleAnalyticsV2ReportGetParams = { resource: 'report'; operation: 'get'; /** * Google Analytics 4 is the latest version. Universal Analytics is an older version that is not fully functional after the end of June 2023. * @default ga4 */ propertyType?: 'ga4' | 'universal'; /** * The Property of Google Analytics * @hint If this doesn't work, try changing the 'Property Type' field above * @displayOptions.show { propertyType: ["ga4"] } * @default {"mode":"list","value":""} */ propertyId?: { __rl: true; mode: 'list' | 'url' | 'id'; value: string; cachedResultName?: string }; /** * Date Range * @displayOptions.show { propertyType: ["ga4"] } * @default last7days */ dateRange?: 'last7days' | 'last30days' | 'today' | 'yesterday' | 'lastCalendarWeek' | 'lastCalendarMonth' | 'custom' | Expression; /** * Start * @displayOptions.show { dateRange: ["custom"], propertyType: ["ga4"] } * @default 2026-04-02T00:00:00.000+00:00 */ startDate?: string | Expression; /** * End * @displayOptions.show { dateRange: ["custom"], propertyType: ["ga4"] } * @default 2026-04-09T00:00:00.000+00:00 */ endDate?: string | Expression; /** * The quantitative measurements of a report. For example, the metric eventCount is the total number of events. Requests are allowed up to 10 metrics. * @displayOptions.show { propertyType: ["ga4"] } * @default {"metricValues":[{"listName":"totalUsers"}]} */ metricsGA4?: { /** Values */ metricValues?: Array<{ /** Metric * @default totalUsers */ listName?: 'active1DayUsers' | 'active28DayUsers' | 'active7DayUsers' | 'checkouts' | 'eventCount' | 'screenPageViews' | 'userEngagementDuration' | 'sessions' | 'sessionsPerUser' | 'totalUsers' | 'other' | 'custom' | Expression; /** The name of the metric. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. * @hint If expression is specified, name can be any string that you would like * @displayOptions.show { listName: ["other"] } * @default totalUsers */ name?: string | Expression; /** Name * @displayOptions.show { listName: ["custom"] } * @default custom_metric */ name?: string | Expression | PlaceholderValue; /** A mathematical expression for derived metrics. For example, the metric Event count per user is eventCount/totalUsers. * @displayOptions.show { listName: ["custom"] } */ expression?: string | Expression | PlaceholderValue; /** Whether a metric is invisible in the report response. If a metric is invisible, the metric will not produce a column in the response, but can be used in metricFilter, orderBys, or a metric expression. * @displayOptions.show { listName: ["custom"] } * @default false */ invisible?: boolean | Expression; }>; }; /** * Dimensions are attributes of your data. For example, the dimension city indicates the city from which an event originates. Dimension values in report responses are strings; for example, the city could be "Paris" or "New York". Requests are allowed up to 9 dimensions. * @displayOptions.show { propertyType: ["ga4"] } * @default {"dimensionValues":[{"listName":"date"}]} */ dimensionsGA4?: { /** Values */ dimensionValues?: Array<{ /** Dimension * @default date */ listName?: 'browser' | 'campaignName' | 'city' | 'country' | 'date' | 'deviceCategory' | 'itemName' | 'language' | 'pageLocation' | 'sourceMedium' | 'other' | Expression; /** The name of the dimension. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. * @displayOptions.show { listName: ["other"] } * @default date */ name?: string | Expression; }>; }; /** * Whether to return all results or only up to a given limit * @displayOptions.show { propertyType: ["ga4"] } * @default false */ returnAll?: boolean | Expression; /** * Max number of results to return * @displayOptions.show { propertyType: ["ga4"], returnAll: [false] } * @default 50 */ limit?: number | Expression; /** * Whether to return a simplified version of the response instead of the raw data * @displayOptions.show { propertyType: ["ga4"] } * @default true */ simple?: boolean | Expression; /** * Additional Fields * @displayOptions.show { propertyType: ["ga4"] } * @default {} */ additionalFields?: { /** A currency code in ISO4217 format, such as "AED", "USD", "JPY". If the field is empty, the report uses the property's default currency. */ currencyCode?: string | Expression | PlaceholderValue; /** Dimensions Filters * @default {} */ dimensionFiltersUI?: { /** Filter Expressions */ filterExpressions?: { /** Filter Expression Type * @default andGroup */ filterExpressionType?: 'andGroup' | 'orGroup' | Expression; /** Expression * @default {} */ expression?: { /** String Filter */ stringFilter?: Array<{ /** Dimension * @default date */ listName?: 'browser' | 'campaignName' | 'city' | 'country' | 'date' | 'deviceCategory' | 'itemName' | 'language' | 'pageLocation' | 'sourceMedium' | 'other' | Expression; /** The name of the dimension. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. * @displayOptions.show { listName: ["other"] } * @default date */ name?: string | Expression; /** Value */ value?: string | Expression | PlaceholderValue; /** Case Sensitive * @default true */ caseSensitive?: boolean | Expression; /** Match Type * @default EXACT */ matchType?: 'BEGINS_WITH' | 'CONTAINS' | 'ENDS_WITH' | 'EXACT' | 'FULL_REGEXP' | 'PARTIAL_REGEXP' | Expression; }>; /** In List Filter */ inListFilter?: Array<{ /** Dimension * @default date */ listName?: 'browser' | 'campaignName' | 'city' | 'country' | 'date' | 'deviceCategory' | 'itemName' | 'language' | 'pageLocation' | 'sourceMedium' | 'other' | Expression; /** The name of the dimension. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. * @displayOptions.show { listName: ["other"] } * @default date */ name?: string | Expression; /** Values * @hint Comma separated list of values. Must be non-empty. */ values?: string | Expression | PlaceholderValue; /** Case Sensitive * @default true */ caseSensitive?: boolean | Expression; }>; /** Numeric Filter */ numericFilter?: Array<{ /** Dimension * @default date */ listName?: 'browser' | 'campaignName' | 'city' | 'country' | 'date' | 'deviceCategory' | 'itemName' | 'language' | 'pageLocation' | 'sourceMedium' | 'other' | Expression; /** The name of the dimension. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. * @displayOptions.show { listName: ["other"] } * @default date */ name?: string | Expression; /** Value Type * @default doubleValue */ valueType?: 'doubleValue' | 'int64Value' | Expression; /** Value */ value?: string | Expression | PlaceholderValue; /** Operation * @default EQUAL */ operation?: 'EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL'; }>; }; }; }; /** Metric Aggregation * @displayOptions.show { /simple: [false] } * @default [] */ metricAggregations?: Array<'MAXIMUM' | 'MINIMUM' | 'TOTAL'>; /** Metrics Filters * @default {} */ metricsFiltersUI?: { /** Filter Expressions */ filterExpressions?: { /** Filter Expression Type * @default andGroup */ filterExpressionType?: 'andGroup' | 'orGroup' | Expression; /** Expression * @default {} */ expression?: { /** Between Filter */ betweenFilter?: Array<{ /** Metric * @default totalUsers */ listName?: 'active1DayUsers' | 'active28DayUsers' | 'active7DayUsers' | 'checkouts' | 'eventCount' | 'screenPageViews' | 'userEngagementDuration' | 'sessions' | 'sessionsPerUser' | 'totalUsers' | 'other' | 'custom' | Expression; /** The name of the metric. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. * @hint If expression is specified, name can be any string that you would like * @displayOptions.show { listName: ["other"] } * @default totalUsers */ name?: string | Expression; /** Name * @displayOptions.show { listName: ["custom"] } * @default custom_metric */ name?: string | Expression | PlaceholderValue; /** Value Type * @default doubleValue */ valueType?: 'doubleValue' | 'int64Value' | Expression; /** From Value */ fromValue?: string | Expression | PlaceholderValue; /** To Value */ toValue?: string | Expression | PlaceholderValue; }>; /** Numeric Filter */ numericFilter?: Array<{ /** Metric * @default totalUsers */ listName?: 'active1DayUsers' | 'active28DayUsers' | 'active7DayUsers' | 'checkouts' | 'eventCount' | 'screenPageViews' | 'userEngagementDuration' | 'sessions' | 'sessionsPerUser' | 'totalUsers' | 'other' | 'custom' | Expression; /** The name of the metric. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. * @hint If expression is specified, name can be any string that you would like * @displayOptions.show { listName: ["other"] } * @default totalUsers */ name?: string | Expression; /** Name * @displayOptions.show { listName: ["custom"] } * @default custom_metric */ name?: string | Expression | PlaceholderValue; /** Value Type * @default doubleValue */ valueType?: 'doubleValue' | 'int64Value' | Expression; /** Value */ value?: string | Expression | PlaceholderValue; /** Operation * @default EQUAL */ operation?: 'EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL'; }>; }; }; }; /** Whether false or unspecified, each row with all metrics equal to 0 will not be returned. If true, these rows will be returned if they are not separately removed by a filter. * @default false */ keepEmptyRows?: boolean | Expression; /** Specifies how rows are ordered in the response * @default {} */ orderByUI?: { /** Metric Order By */ metricOrderBy?: Array<{ /** Whether true, sorts by descending order * @default false */ desc?: boolean | Expression; /** Sorts by metric values. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. */ metricName?: string | Expression; }>; /** Dimmension Order By */ dimmensionOrderBy?: Array<{ /** Whether true, sorts by descending order * @default false */ desc?: boolean | Expression; /** Sorts by metric values. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. */ dimensionName?: string | Expression; /** Order Type * @default ORDER_TYPE_UNSPECIFIED */ orderType?: 'ALPHANUMERIC' | 'CASE_INSENSITIVE_ALPHANUMERIC' | 'NUMERIC' | 'ORDER_TYPE_UNSPECIFIED' | Expression; }>; }; /** Whether to return the current state of this Analytics Property's quota. Quota is returned in PropertyQuota. * @displayOptions.show { /simple: [false] } * @default false */ returnPropertyQuota?: boolean | Expression; }; /** * The View of Google Analytics * @hint If this doesn't work, try changing the 'Property Type' field above * @displayOptions.show { propertyType: ["universal"] } * @default {"mode":"list","value":""} */ viewId?: { __rl: true; mode: 'list' | 'url' | 'id'; value: string; cachedResultName?: string }; /** * Metrics in the request * @displayOptions.show { propertyType: ["universal"] } * @default {"metricValues":[{"listName":"ga:users"}]} */ metricsUA?: { /** Metric */ metricValues?: Array<{ /** Metric * @default ga:users */ listName?: 'ga:productCheckouts' | 'ga:totalEvents' | 'ga:pageviews' | 'ga:sessionDuration' | 'ga:sessions' | 'ga:sessionsPerUser' | 'ga:users' | 'other' | 'custom' | Expression; /** The name of the metric. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. * @hint If expression is specified, name can be any string that you would like * @displayOptions.show { listName: ["other"] } * @default ga:users */ name?: string | Expression; /** Name * @displayOptions.show { listName: ["custom"] } * @default custom_metric */ name?: string | Expression | PlaceholderValue; /** Learn more about Google Analytics <a href="https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet#Metric">metric expressions</a> * @displayOptions.show { listName: ["custom"] } */ expression?: string | Expression | PlaceholderValue; /** Specifies how the metric expression should be formatted * @displayOptions.show { listName: ["custom"] } * @default INTEGER */ formattingType?: 'CURRENCY' | 'FLOAT' | 'INTEGER' | 'PERCENT' | 'TIME' | Expression; }>; }; /** * Dimensions are attributes of your data. For example, the dimension ga:city indicates the city, for example, "Paris" or "New York", from which a session originates. * @displayOptions.show { propertyType: ["universal"] } * @default {"dimensionValues":[{"listName":"ga:date"}]} */ dimensionsUA?: { /** Values */ dimensionValues?: Array<{ /** Dimension * @default ga:date */ listName?: 'ga:browser' | 'ga:campaign' | 'ga:city' | 'ga:country' | 'ga:date' | 'ga:deviceCategory' | 'ga:productName' | 'ga:language' | 'ga:pagePath' | 'ga:sourceMedium' | 'other' | Expression; /** Name of the dimension to fetch, for example ga:browser. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. * @displayOptions.show { listName: ["other"] } * @default ga:date */ name?: string | Expression; }>; }; }; export type GoogleAnalyticsV2ReportGetOutput = { date?: string; dimensionHeaders?: Array<{ name?: string; }>; kind?: string; metadata?: { currencyCode?: string; timeZone?: string; }; metricHeaders?: Array<{ name?: string; type?: string; }>; sessions?: string; totalUsers?: string; }; export type GoogleAnalyticsV2ReportGetNode = { type: 'n8n-nodes-base.googleAnalytics'; version: 2; credentials?: Credentials; config: NodeConfig; output?: Items; };