diff --git a/google-analytics-admin/.eslintrc.json b/google-analytics-admin/.eslintrc.json deleted file mode 100644 index e2ed1b3..0000000 --- a/google-analytics-admin/.eslintrc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "env": { - "browser": true, - "commonjs": true, - "es2021": true - }, - "extends": "google", - "parserOptions": { - "ecmaVersion": "latest" - }, - "rules": { - } -} \ No newline at end of file diff --git a/google-analytics-admin/eslint.config.mjs b/google-analytics-admin/eslint.config.mjs new file mode 100644 index 0000000..fea8680 --- /dev/null +++ b/google-analytics-admin/eslint.config.mjs @@ -0,0 +1,40 @@ +import {defineConfig} from 'eslint/config'; +import globals from 'globals'; +import path from 'node:path'; +import {fileURLToPath} from 'node:url'; +import js from '@eslint/js'; +import {FlatCompat} from '@eslint/eslintrc'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +const googleConfig = compat.extends('google'); +for (const config of googleConfig) { + if (config.rules) { + delete config.rules['valid-jsdoc']; + delete config.rules['require-jsdoc']; + } +} + +export default defineConfig([ + ...googleConfig, + { + files: ['*.js'], + languageOptions: { + globals: { + ...globals.browser, + ...globals.commonjs, + }, + + ecmaVersion: 'latest', + sourceType: 'script', + }, + + rules: {}, + }, +]); diff --git a/google-analytics-admin/package.json b/google-analytics-admin/package.json index 19c90f6..79b09c8 100644 --- a/google-analytics-admin/package.json +++ b/google-analytics-admin/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" }, "files": [ "*.js" @@ -25,10 +25,13 @@ "url": "^0.11.0" }, "devDependencies": { + "@eslint/eslintrc": "^3.3.3", + "@eslint/js": "^9.39.2", "c8": "^10.0.0", "chai": "^4.2.0", - "eslint": "^8.53.0", + "eslint": "^10.0.0", "eslint-config-google": "^0.14.0", + "globals": "^17.3.0", "mocha": "^11.0.0" } } diff --git a/google-analytics-admin/quickstart.js b/google-analytics-admin/quickstart.js index 7033d8b..d2e6392 100644 --- a/google-analytics-admin/quickstart.js +++ b/google-analytics-admin/quickstart.js @@ -58,7 +58,7 @@ function main() { // [END analytics_admin_quickstart] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/.eslintrc.json b/google-analytics-data/.eslintrc.json deleted file mode 100644 index e2ed1b3..0000000 --- a/google-analytics-data/.eslintrc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "env": { - "browser": true, - "commonjs": true, - "es2021": true - }, - "extends": "google", - "parserOptions": { - "ecmaVersion": "latest" - }, - "rules": { - } -} \ No newline at end of file diff --git a/google-analytics-data/eslint.config.mjs b/google-analytics-data/eslint.config.mjs new file mode 100644 index 0000000..7127bc1 --- /dev/null +++ b/google-analytics-data/eslint.config.mjs @@ -0,0 +1,40 @@ +import {defineConfig} from 'eslint/config'; +import globals from 'globals'; +import path from 'node:path'; +import {fileURLToPath} from 'node:url'; +import js from '@eslint/js'; +import {FlatCompat} from '@eslint/eslintrc'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +const googleConfig = compat.extends('google'); +for (const config of googleConfig) { + if (config.rules) { + delete config.rules['valid-jsdoc']; + delete config.rules['require-jsdoc']; + } +} + +export default defineConfig([ + ...googleConfig, + { + files: ['*.js', 'test/*.js'], + languageOptions: { + globals: { + ...globals.browser, + ...globals.commonjs, + }, + + ecmaVersion: 'latest', + sourceType: 'script', + }, + + rules: {}, + }, +]); diff --git a/google-analytics-data/get_common_metadata.js b/google-analytics-data/get_common_metadata.js index 0720136..fc2bb27 100644 --- a/google-analytics-data/get_common_metadata.js +++ b/google-analytics-data/get_common_metadata.js @@ -14,18 +14,19 @@ 'use strict'; -/** Google Analytics Data API sample application retrieving dimension and metrics -metadata. - -See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata -for more information. - - Before you start the application, please review the comments starting with - "TODO(developer)" and update the code to use correct values. - - Usage: - npm install - node getCommonMetadata.js +/** + * Google Analytics Data API sample application retrieving dimension and metrics + * metadata. + * + * See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata + * for more information. + * + * Before you start the application, please review the comments starting with + * "TODO(developer)" and update the code to use correct values. + * + * Usage: + * npm install + * node getCommonMetadata.js */ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { @@ -43,13 +44,15 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // needs to be created once, and can be reused for multiple requests. const analyticsDataClient = new BetaAnalyticsDataClient(); - // Retrieves dimensions and metrics available for all Google Analytics 4 properties. + // Retrieves dimensions and metrics available for all Google Analytics 4 + // properties. async function getCommonMetadata() { const [response] = await analyticsDataClient.getMetadata({ name: `properties/${propertyId}/metadata`, }); console.log( - 'Dimensions and metrics available for all Google Analytics 4 properties:' + 'Dimensions and metrics available for all ' + + 'Google Analytics 4 properties:', ); printGetMetadataResponse(response); } @@ -58,11 +61,12 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of the getMetadata call. function printGetMetadataResponse(response) { - //[START analyticsdata_print_get_metadata_response] - response.dimensions.forEach(dimension => { + // [START analyticsdata_print_get_metadata_response] + response.dimensions.forEach((dimension) => { console.log('DIMENSION'); console.log( - `${dimension.apiName} (${dimension.uiName}): ${dimension.description}` + `${dimension.apiName} (${dimension.uiName}): ` + + `${dimension.description}`, ); console.log(`custom definition: ${dimension.customDefinition}`); if ( @@ -74,10 +78,10 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { console.log(); }); - response.metrics.forEach(metric => { + response.metrics.forEach((metric) => { console.log('METRIC'); console.log( - `${metric.apiName} (${metric.uiName}): ${metric.description}` + `${metric.apiName} (${metric.uiName}): ${metric.description}`, ); console.log(`custom definition: ${metric.customDefinition}`); if (metric.expression) { @@ -94,7 +98,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_get_common_metadata] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/get_metadata_by_property_id.js b/google-analytics-data/get_metadata_by_property_id.js index b2932e6..e21e99b 100644 --- a/google-analytics-data/get_metadata_by_property_id.js +++ b/google-analytics-data/get_metadata_by_property_id.js @@ -14,18 +14,19 @@ 'use strict'; -/** Google Analytics Data API sample application retrieving dimension and metrics -metadata. - -See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata -for more information. - - Before you start the application, please review the comments starting with - "TODO(developer)" and update the code to use correct values. - - Usage: - npm install - node getMetadataByPropertyId.js +/** + * Google Analytics Data API sample application retrieving dimension and metrics + * metadata. + * + * See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata + * for more information. + * + * Before you start the application, please review the comments starting with + * "TODO(developer)" and update the code to use correct values. + * + * Usage: + * npm install + * node getMetadataByPropertyId.js */ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { @@ -49,7 +50,8 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { name: `properties/${propertyId}/metadata`, }); console.log( - `Dimensions and metrics available for a Google Analytics 4 property ${propertyId} (including custom fields):` + 'Dimensions and metrics available for a Google Analytics 4 ' + + `property ${propertyId} (including custom fields):`, ); printGetMetadataResponse(response); } @@ -58,11 +60,12 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of the getMetadata call. function printGetMetadataResponse(response) { - //[START analyticsdata_print_get_metadata_response] - response.dimensions.forEach(dimension => { + // [START analyticsdata_print_get_metadata_response] + response.dimensions.forEach((dimension) => { console.log('DIMENSION'); console.log( - `${dimension.apiName} (${dimension.uiName}): ${dimension.description}` + `${dimension.apiName} (${dimension.uiName}): ` + + `${dimension.description}`, ); console.log(`custom definition: ${dimension.customDefinition}`); if ( @@ -74,10 +77,10 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { console.log(); }); - response.metrics.forEach(metric => { + response.metrics.forEach((metric) => { console.log('METRIC'); console.log( - `${metric.apiName} (${metric.uiName}): ${metric.description}` + `${metric.apiName} (${metric.uiName}): ${metric.description}`, ); console.log(`custom definition: ${metric.customDefinition}`); if (metric.expression) { @@ -94,7 +97,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_get_metadata_by_property_id] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/package.json b/google-analytics-data/package.json index 6cdf38b..8e58d44 100644 --- a/google-analytics-data/package.json +++ b/google-analytics-data/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" }, "files": [ "*.js" @@ -25,10 +25,13 @@ "url": "^0.11.0" }, "devDependencies": { + "@eslint/eslintrc": "^3.3.3", + "@eslint/js": "^9.39.2", "c8": "^10.0.0", "chai": "^4.2.0", - "eslint": "^8.53.0", + "eslint": "^10.0.0", "eslint-config-google": "^0.14.0", + "globals": "^17.3.0", "mocha": "^11.0.0" } } diff --git a/google-analytics-data/quickstart_json_credentials.js b/google-analytics-data/quickstart_json_credentials.js index 431ecce..337d882 100644 --- a/google-analytics-data/quickstart_json_credentials.js +++ b/google-analytics-data/quickstart_json_credentials.js @@ -78,7 +78,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID', credentialsJsonPath = '') { // [END analyticsdata_json_credentials_run_report] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log(row.dimensionValues[0], row.metricValues[0]); }); } @@ -87,7 +87,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID', credentialsJsonPath = '') { // [END analyticsdata_json_credentials_quickstart] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/quickstart_oauth2.js b/google-analytics-data/quickstart_oauth2.js index 53cbd82..487f609 100644 --- a/google-analytics-data/quickstart_oauth2.js +++ b/google-analytics-data/quickstart_oauth2.js @@ -35,8 +35,8 @@ const destroyer = require('server-destroy'); // TODO(developer): Download the OAuth 2.0 client ID JSON from // https://console.cloud.google.com/apis/credentials for a Desktop or Web -// client, and save it in the nodejs-docs-samples/google-analytics-data directory -// in a file named oauth2.keys.json. If using a Web client, register +// client, and save it in the nodejs-docs-samples/google-analytics-data +// directory in a file named oauth2.keys.json. If using a Web client, register // http://127.0.0.1 as an authorized redirect URI. const keys = require('./oauth2.keys.json'); @@ -49,8 +49,8 @@ async function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Constructs a BetaAnalyticsDataClient using the credentials obtained above // instead of the Application Default Credentials. const credentials = grpc.credentials.combineChannelCredentials( - grpc.credentials.createSsl(), - grpc.credentials.createFromGoogleCredential(oAuth2Client) + grpc.credentials.createSsl(), + grpc.credentials.createFromGoogleCredential(oAuth2Client), ); const analyticsDataClient = new BetaAnalyticsDataClient({ sslCreds: credentials, diff --git a/google-analytics-data/run_batch_report.js b/google-analytics-data/run_batch_report.js index 7cf885c..68f5bf5 100644 --- a/google-analytics-data/run_batch_report.js +++ b/google-analytics-data/run_batch_report.js @@ -14,18 +14,19 @@ 'use strict'; -/** Google Analytics Data API sample application demonstrating the batch creation -of multiple reports. - -See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/batchRunReports -for more information. - - Before you start the application, please review the comments starting with - "TODO(developer)" and update the code to use correct values. - - Usage: - npm install - node runBatchReport.js +/** + * Google Analytics Data API sample application demonstrating the batch creation + * of multiple reports. + * + * See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/batchRunReports + * for more information. + * + * Before you start the application, please review the comments starting with + * "TODO(developer)" and update the code to use correct values. + * + * Usage: + * npm install + * node runBatchReport.js */ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { @@ -93,7 +94,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { }); console.log('Batch report results:'); - response.reports.forEach(report => { + response.reports.forEach((report) => { printRunReportResponse(report); }); } @@ -102,23 +103,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -126,7 +127,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_batch_report] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_funnel_report.js b/google-analytics-data/run_funnel_report.js index 513b498..8a12650 100644 --- a/google-analytics-data/run_funnel_report.js +++ b/google-analytics-data/run_funnel_report.js @@ -58,7 +58,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { property: `properties/${propertyId}`, dateRanges: [{startDate: '30daysAgo', endDate: 'today'}], funnelBreakdown: { - breakdownDimension: { name: 'deviceCategory' }, + breakdownDimension: {name: 'deviceCategory'}, }, funnel: { steps: [ @@ -67,11 +67,11 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { filterExpression: { orGroup: { expressions: [ - { funnelEventFilter: {eventName: 'first_open'}}, - { funnelEventFilter: {eventName: 'first_visit'}} - ] - } - } + {funnelEventFilter: {eventName: 'first_open'}}, + {funnelEventFilter: {eventName: 'first_visit'}}, + ], + }, + }, }, { name: 'Organic visitors', @@ -81,54 +81,54 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { stringFilter: { matchType: 'CONTAINS', caseSensitive: false, - value: 'organic' - } - } - } + value: 'organic', + }, + }, + }, }, { name: 'Session start', filterExpression: { funnelEventFilter: { eventName: 'session_start', - } - } + }, + }, }, { name: 'Screen/Page view', filterExpression: { orGroup: { expressions: [ - { funnelEventFilter: {eventName: 'screen_view'}}, - { funnelEventFilter: {eventName: 'page_view'}}, - ] - } - } + {funnelEventFilter: {eventName: 'screen_view'}}, + {funnelEventFilter: {eventName: 'page_view'}}, + ], + }, + }, }, { name: 'Screen/Page view', filterExpression: { orGroup: { expressions: [ - { funnelEventFilter: {eventName: 'screen_view'}}, - { funnelEventFilter: {eventName: 'page_view'}}, - ] - } - } + {funnelEventFilter: {eventName: 'screen_view'}}, + {funnelEventFilter: {eventName: 'page_view'}}, + ], + }, + }, }, { name: 'Purchase', filterExpression: { orGroup: { expressions: [ - { funnelEventFilter: {eventName: 'purchase'}}, - { funnelEventFilter: {eventName: 'in_app_purchase'}}, - ] - } - } + {funnelEventFilter: {eventName: 'purchase'}}, + {funnelEventFilter: {eventName: 'in_app_purchase'}}, + ], + }, + }, }, - ] - } + ], + }, }); printRunFunnelReportResponse(response); } @@ -137,33 +137,36 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints contents of a FunnelSubReport object. function printFunnelSubReport(funnelSubReport) { console.log('Dimension headers:'); - funnelSubReport.dimensionHeaders.forEach(dimensionHeader => { + funnelSubReport.dimensionHeaders.forEach((dimensionHeader) => { console.log(dimensionHeader.name); }); console.log('\nMetric headers:'); - funnelSubReport.metricHeaders.forEach(metricHeader => { + funnelSubReport.metricHeaders.forEach((metricHeader) => { console.log(metricHeader.name); }); console.log('\nDimensions and metric values for each row in the report:'); funnelSubReport.rows.forEach((row, rowIndex) => { console.log(`\nRow #${rowIndex}`); row.dimensionValues.forEach((dimensionValue, dimensionIndex) => { - const dimensionName = funnelSubReport.dimensionHeaders[dimensionIndex].name; + const dimensionName = + funnelSubReport.dimensionHeaders[dimensionIndex].name; console.log(`\n${dimensionName}: ${dimensionValue.value}`); - }) + }); row.metricValues.forEach((metricValue, metricIndex) => { const metricName = funnelSubReport.metricHeaders[metricIndex].name; console.log(`\n${metricName}: ${metricValue.value}`); - }) + }); }); console.log('\nSampling metadata for each date range:'); - funnelSubReport.metadata.samplingMetadatas.forEach((metadata, metadataIndex) => { - console.log(`Sampling metadata for date range #${metadataIndex}: ` - `samplesReadCount=${metadata.samplesReadCount}, ` - `samplingSpaceSize=${metadata.samplingSpaceSize}` - ); + const samplingMetadatas = funnelSubReport.metadata.samplingMetadatas; + samplingMetadatas.forEach((metadata, metadataIndex) => { + console.log( + `Sampling metadata for date range #${metadataIndex}: ` + + `samplesReadCount=${metadata.samplesReadCount}, ` + + `samplingSpaceSize=${metadata.samplingSpaceSize}`, + ); }); } @@ -182,7 +185,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_funnel_report] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_pivot_report.js b/google-analytics-data/run_pivot_report.js index 73f0704..2634623 100644 --- a/google-analytics-data/run_pivot_report.js +++ b/google-analytics-data/run_pivot_report.js @@ -42,7 +42,8 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // needs to be created once, and can be reused for multiple requests. const analyticsDataClient = new BetaAnalyticsDataClient(); - // Runs a pivot query to build a report of session counts by country, pivoted by the browser dimension. + // Runs a pivot query to build a report of session counts by country, pivoted + // by the browser dimension. async function runPivotReport() { const [response] = await analyticsDataClient.runPivotReport({ property: `properties/${propertyId}`, @@ -99,14 +100,14 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printPivotReportResponse(response) { - //[START analyticsdata_print_run_pivot_report_response] + // [START analyticsdata_print_run_pivot_report_response] console.log('Report result:'); - response.rows.forEach(row => { - row.dimensionValues.forEach(dimensionValue => { + response.rows.forEach((row) => { + row.dimensionValues.forEach((dimensionValue) => { console.log(dimensionValue.value); }); - row.metricValues.forEach(metricValue => { + row.metricValues.forEach((metricValue) => { console.log(metricValue.value); }); }); @@ -115,7 +116,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_pivot_report] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_realtime_report.js b/google-analytics-data/run_realtime_report.js index e30f36d..261d648 100644 --- a/google-analytics-data/run_realtime_report.js +++ b/google-analytics-data/run_realtime_report.js @@ -100,23 +100,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -124,7 +124,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_realtime_report] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_realtime_report_with_minute_ranges.js b/google-analytics-data/run_realtime_report_with_minute_ranges.js index 79b2b4c..5ed0d5a 100644 --- a/google-analytics-data/run_realtime_report_with_minute_ranges.js +++ b/google-analytics-data/run_realtime_report_with_minute_ranges.js @@ -72,26 +72,26 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); } // [END analyticsdata_run_realtime_report_with_minute_ranges] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_realtime_report_with_multiple_dimensions.js b/google-analytics-data/run_realtime_report_with_multiple_dimensions.js index ed5a1d3..69aba56 100644 --- a/google-analytics-data/run_realtime_report_with_multiple_dimensions.js +++ b/google-analytics-data/run_realtime_report_with_multiple_dimensions.js @@ -104,23 +104,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -128,7 +128,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_realtime_report_with_multiple_dimensions] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_realtime_report_with_multiple_metrics.js b/google-analytics-data/run_realtime_report_with_multiple_metrics.js index 93dc50d..3530ad0 100644 --- a/google-analytics-data/run_realtime_report_with_multiple_metrics.js +++ b/google-analytics-data/run_realtime_report_with_multiple_metrics.js @@ -105,23 +105,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -129,7 +129,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_realtime_report_with_multiple_metrics] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report.js b/google-analytics-data/run_report.js index 0d27616..9e5799a 100644 --- a/google-analytics-data/run_report.js +++ b/google-analytics-data/run_report.js @@ -68,23 +68,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -94,7 +94,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_aggregations.js b/google-analytics-data/run_report_with_aggregations.js index a059a30..3b75051 100644 --- a/google-analytics-data/run_report_with_aggregations.js +++ b/google-analytics-data/run_report_with_aggregations.js @@ -73,23 +73,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -97,7 +97,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_aggregations] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_cohorts.js b/google-analytics-data/run_report_with_cohorts.js index 34f7bc0..94b14c4 100644 --- a/google-analytics-data/run_report_with_cohorts.js +++ b/google-analytics-data/run_report_with_cohorts.js @@ -90,23 +90,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -114,7 +114,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_cohorts] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_date_ranges.js b/google-analytics-data/run_report_with_date_ranges.js index bec6c28..89cfd00 100644 --- a/google-analytics-data/run_report_with_date_ranges.js +++ b/google-analytics-data/run_report_with_date_ranges.js @@ -74,23 +74,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -98,7 +98,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_date_ranges] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_dimension_and_metric_filters.js b/google-analytics-data/run_report_with_dimension_and_metric_filters.js index 3a53203..29f9175 100644 --- a/google-analytics-data/run_report_with_dimension_and_metric_filters.js +++ b/google-analytics-data/run_report_with_dimension_and_metric_filters.js @@ -108,23 +108,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -132,7 +132,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_dimension_and_metric_filters] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_dimension_exclude_filter.js b/google-analytics-data/run_report_with_dimension_exclude_filter.js index 6b7266d..8e9354f 100644 --- a/google-analytics-data/run_report_with_dimension_exclude_filter.js +++ b/google-analytics-data/run_report_with_dimension_exclude_filter.js @@ -84,23 +84,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -108,7 +108,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_dimension_exclude_filter] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_dimension_filter.js b/google-analytics-data/run_report_with_dimension_filter.js index 5d15b3a..b1516be 100644 --- a/google-analytics-data/run_report_with_dimension_filter.js +++ b/google-analytics-data/run_report_with_dimension_filter.js @@ -83,23 +83,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -107,7 +107,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_dimension_filter] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_dimension_in_list_filter.js b/google-analytics-data/run_report_with_dimension_in_list_filter.js index bf5b1a1..9c0bd82 100644 --- a/google-analytics-data/run_report_with_dimension_in_list_filter.js +++ b/google-analytics-data/run_report_with_dimension_in_list_filter.js @@ -87,23 +87,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -111,7 +111,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_dimension_in_list_filter] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_multiple_dimension_filters.js b/google-analytics-data/run_report_with_multiple_dimension_filters.js index 5746361..8daa44b 100644 --- a/google-analytics-data/run_report_with_multiple_dimension_filters.js +++ b/google-analytics-data/run_report_with_multiple_dimension_filters.js @@ -97,23 +97,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -121,7 +121,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_multiple_dimension_filters] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_multiple_dimensions.js b/google-analytics-data/run_report_with_multiple_dimensions.js index 583ebb9..4551a89 100644 --- a/google-analytics-data/run_report_with_multiple_dimensions.js +++ b/google-analytics-data/run_report_with_multiple_dimensions.js @@ -76,23 +76,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -100,7 +100,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_multiple_dimensions] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_multiple_metrics.js b/google-analytics-data/run_report_with_multiple_metrics.js index 1699ba6..9dd14c6 100644 --- a/google-analytics-data/run_report_with_multiple_metrics.js +++ b/google-analytics-data/run_report_with_multiple_metrics.js @@ -76,23 +76,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -100,7 +100,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_multiple_metrics] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_named_date_ranges.js b/google-analytics-data/run_report_with_named_date_ranges.js index dc4aac6..9e963bd 100644 --- a/google-analytics-data/run_report_with_named_date_ranges.js +++ b/google-analytics-data/run_report_with_named_date_ranges.js @@ -76,23 +76,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -100,7 +100,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_named_date_ranges] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_ordering.js b/google-analytics-data/run_report_with_ordering.js index 880a32f..343c54b 100644 --- a/google-analytics-data/run_report_with_ordering.js +++ b/google-analytics-data/run_report_with_ordering.js @@ -85,23 +85,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -109,7 +109,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_ordering] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_pagination.js b/google-analytics-data/run_report_with_pagination.js index f775709..de1e704 100644 --- a/google-analytics-data/run_report_with_pagination.js +++ b/google-analytics-data/run_report_with_pagination.js @@ -126,23 +126,23 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // Prints results of a runReport call. function printRunReportResponse(response) { - //[START analyticsdata_print_run_report_response_header] + // [START analyticsdata_print_run_report_response_header] console.log(`${response.rowCount} rows received`); - response.dimensionHeaders.forEach(dimensionHeader => { + response.dimensionHeaders.forEach((dimensionHeader) => { console.log(`Dimension header name: ${dimensionHeader.name}`); }); - response.metricHeaders.forEach(metricHeader => { + response.metricHeaders.forEach((metricHeader) => { console.log( - `Metric header name: ${metricHeader.name} (${metricHeader.type})` + `Metric header name: ${metricHeader.name} (${metricHeader.type})`, ); }); - //[END analyticsdata_print_run_report_response_header] + // [END analyticsdata_print_run_report_response_header] // [START analyticsdata_print_run_report_response_rows] console.log('Report result:'); - response.rows.forEach(row => { + response.rows.forEach((row) => { console.log( - `${row.dimensionValues[0].value}, ${row.metricValues[0].value}` + `${row.dimensionValues[0].value}, ${row.metricValues[0].value}`, ); }); // [END analyticsdata_print_run_report_response_rows] @@ -150,7 +150,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_pagination] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/run_report_with_property_quota.js b/google-analytics-data/run_report_with_property_quota.js index 6eb0ee6..25f1dc9 100644 --- a/google-analytics-data/run_report_with_property_quota.js +++ b/google-analytics-data/run_report_with_property_quota.js @@ -73,32 +73,33 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { function printPropertyQuotaResponse(response) { // [START analyticsdata_run_report_with_property_quota_print_response] if (response.propertyQuota) { + const quota = response.propertyQuota; console.log( - `Tokens per day quota consumed: ${response.propertyQuota.tokensPerDay.consumed},` + - ` remaining: ${response.propertyQuota.tokensPerDay.remaining}` + `Tokens per day quota consumed: ${quota.tokensPerDay.consumed}, ` + + `remaining: ${quota.tokensPerDay.remaining}`, ); console.log( - `Tokens per hour quota consumed: ${response.propertyQuota.tokensPerHour.consumed}` + - `, remaining: ${response.propertyQuota.tokensPerHour.remaining}` + `Tokens per hour quota consumed: ${quota.tokensPerHour.consumed}, ` + + `remaining: ${quota.tokensPerHour.remaining}`, ); console.log( - `Concurrent requests quota consumed: ${response.propertyQuota.concurrentRequests.consumed}` + - `, remaining: ${response.propertyQuota.concurrentRequests.remaining}` + `Concurrent requests quota consumed: ` + + `${quota.concurrentRequests.consumed}, ` + + `remaining: ${quota.concurrentRequests.remaining}`, ); console.log( - 'Server errors per project per hour quota consumed: ' + - response.propertyQuota.serverErrorsPerProjectPerHour.consumed + - ', remaining: ' + - response.propertyQuota.serverErrorsPerProjectPerHour.remaining + `Server errors per project per hour quota consumed: ` + + `${quota.serverErrorsPerProjectPerHour.consumed}, ` + + `remaining: ${quota.serverErrorsPerProjectPerHour.remaining}`, ); console.log( - 'Potentially thresholded requests per hour quota consumed: ' + - `${response.propertyQuota.potentiallyThresholdedRequestsPerHour.consumed}` + - `, remaining: ${response.propertyQuota.potentiallyThresholdedRequestsPerHour.remaining}` + `Potentially thresholded requests per hour quota consumed: ` + + `${quota.potentiallyThresholdedRequestsPerHour.consumed}, ` + + `remaining: ${quota.potentiallyThresholdedRequestsPerHour.remaining}`, ); } // [END analyticsdata_run_report_with_property_quota_print_response] @@ -106,7 +107,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') { // [END analyticsdata_run_report_with_property_quota] } -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { console.error(err.message); process.exitCode = 1; }); diff --git a/google-analytics-data/test/get_common_metadata.test.js b/google-analytics-data/test/get_common_metadata.test.js index f41b408..14bdee0 100644 --- a/google-analytics-data/test/get_common_metadata.test.js +++ b/google-analytics-data/test/get_common_metadata.test.js @@ -21,14 +21,18 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Get common metadata', () => { - it('should retrieve all metrics and dimensions for Google Analytics 4 properties', async () => { - // eslint-disable-next-line no-unused-vars - const stdout = execSync(`node ./get_common_metadata.js ${GA4_PROPERTY_ID}`); - assert.match(stdout, /Dimensions and metrics/); - }); + it( + 'should retrieve all metrics and dimensions for Google ' + + 'Analytics 4 properties', + async () => { + const stdout = execSync( + `node ./get_common_metadata.js ${GA4_PROPERTY_ID}`, + ); + assert.match(stdout, /Dimensions and metrics/); + }); }); diff --git a/google-analytics-data/test/get_metadata_by_propert_id.test.js b/google-analytics-data/test/get_metadata_by_propert_id.test.js index cd73faa..6f828f1 100644 --- a/google-analytics-data/test/get_metadata_by_propert_id.test.js +++ b/google-analytics-data/test/get_metadata_by_propert_id.test.js @@ -21,16 +21,18 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Get metadata by property id', () => { - it('should retrieve available dimensions and metrics available for a Google Analytics 4 property, including custom fields', async () => { - // eslint-disable-next-line no-unused-vars - const stdout = execSync( - `node ./get_metadata_by_property_id.js ${GA4_PROPERTY_ID}` - ); - assert.match(stdout, /Dimensions and metrics/); - }); + it( + 'should retrieve available dimensions and metrics available for a ' + + 'Google Analytics 4 property, including custom fields', + async () => { + const stdout = execSync( + `node ./get_metadata_by_property_id.js ${GA4_PROPERTY_ID}`, + ); + assert.match(stdout, /Dimensions and metrics/); + }); }); diff --git a/google-analytics-data/test/quickstart.test.js b/google-analytics-data/test/quickstart.test.js index b19d982..e4dd8d1 100644 --- a/google-analytics-data/test/quickstart.test.js +++ b/google-analytics-data/test/quickstart.test.js @@ -21,13 +21,12 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Quickstart', () => { it('should run quickstart', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync(`node ./quickstart.js ${GA4_PROPERTY_ID}`); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/quickstart_json_credentials.test.js b/google-analytics-data/test/quickstart_json_credentials.test.js index 99b750b..5c63c4b 100644 --- a/google-analytics-data/test/quickstart_json_credentials.test.js +++ b/google-analytics-data/test/quickstart_json_credentials.test.js @@ -21,7 +21,7 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; @@ -31,12 +31,13 @@ const GOOGLE_APPLICATION_CREDENTIALS = describe('Quickstart with json credentials', function() { it('should run quickstart if ADC env var set', function() { if (process.env.GOOGLE_APPLICATION_CREDENTIALS) { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./quickstart_json_credentials.js ${GA4_PROPERTY_ID} ${GOOGLE_APPLICATION_CREDENTIALS}` + `node ./quickstart_json_credentials.js ${GA4_PROPERTY_ID} ` + + `${GOOGLE_APPLICATION_CREDENTIALS}`, ); assert.match(stdout, /Report result/); } else { + // eslint-disable-next-line no-invalid-this this.skip(); } }); diff --git a/google-analytics-data/test/run_batch_report.test.js b/google-analytics-data/test/run_batch_report.test.js index 318dc87..beac6c1 100644 --- a/google-analytics-data/test/run_batch_report.test.js +++ b/google-analytics-data/test/run_batch_report.test.js @@ -21,13 +21,12 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Batch report', () => { it('should run a batch report on a Google Analytics 4 property', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync(`node ./run_batch_report.js ${GA4_PROPERTY_ID}`); assert.match(stdout, /Batch report result/); }); diff --git a/google-analytics-data/test/run_funnel_report.test.js b/google-analytics-data/test/run_funnel_report.test.js index df7e170..bcf350e 100644 --- a/google-analytics-data/test/run_funnel_report.test.js +++ b/google-analytics-data/test/run_funnel_report.test.js @@ -21,13 +21,12 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('RunFunnelReport', () => { it('should run runFunnelReport', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync(`node ./run_funnel_report.js ${GA4_PROPERTY_ID}`); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_pivot_report.test.js b/google-analytics-data/test/run_pivot_report.test.js index 613fbfc..1d7867e 100644 --- a/google-analytics-data/test/run_pivot_report.test.js +++ b/google-analytics-data/test/run_pivot_report.test.js @@ -21,14 +21,18 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Pivot report', () => { - it('should run a pivot query to build a report of session counts by country, pivoted by the browser dimension', async () => { - // eslint-disable-next-line no-unused-vars - const stdout = execSync(`node ./run_pivot_report.js ${GA4_PROPERTY_ID}`); - assert.match(stdout, /Report result/); - }); + it( + 'should run a pivot query to build a report of session counts by ' + + 'country, pivoted by the browser dimension', + async () => { + const stdout = execSync( + `node ./run_pivot_report.js ${GA4_PROPERTY_ID}`, + ); + assert.match(stdout, /Report result/); + }); }); diff --git a/google-analytics-data/test/run_realtime_report.test.js b/google-analytics-data/test/run_realtime_report.test.js index 3bd0513..ad7bb19 100644 --- a/google-analytics-data/test/run_realtime_report.test.js +++ b/google-analytics-data/test/run_realtime_report.test.js @@ -21,13 +21,12 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Realtime report', () => { it('should run realtime', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync(`node ./run_realtime_report.js ${GA4_PROPERTY_ID}`); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_realtime_report_with_minute_ranges.test.js b/google-analytics-data/test/run_realtime_report_with_minute_ranges.test.js index a6a32b3..bdf5662 100644 --- a/google-analytics-data/test/run_realtime_report_with_minute_ranges.test.js +++ b/google-analytics-data/test/run_realtime_report_with_minute_ranges.test.js @@ -21,14 +21,15 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Realtime report with minute ranges', () => { it('should run realtime', async () => { - // eslint-disable-next-line no-unused-vars - const stdout = execSync(`node ./run_realtime_report_with_minute_ranges.js ${GA4_PROPERTY_ID}`); + const stdout = execSync( + `node ./run_realtime_report_with_minute_ranges.js ${GA4_PROPERTY_ID}`, + ); assert.match(stdout, /Report result/); }); }); diff --git a/google-analytics-data/test/run_realtime_report_with_multiple_dimensions.test.js b/google-analytics-data/test/run_realtime_report_with_multiple_dimensions.test.js index 85aa6ba..156a7f5 100644 --- a/google-analytics-data/test/run_realtime_report_with_multiple_dimensions.test.js +++ b/google-analytics-data/test/run_realtime_report_with_multiple_dimensions.test.js @@ -21,15 +21,15 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Realtime report with multiple dimensions', () => { it('should run realtime with multiple dimensions', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_realtime_report_with_multiple_dimensions.js ${GA4_PROPERTY_ID}` + 'node ./run_realtime_report_with_multiple_dimensions.js ' + + `${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_realtime_report_with_multiple_metrics.test.js b/google-analytics-data/test/run_realtime_report_with_multiple_metrics.test.js index ecb60c4..3afdc12 100644 --- a/google-analytics-data/test/run_realtime_report_with_multiple_metrics.test.js +++ b/google-analytics-data/test/run_realtime_report_with_multiple_metrics.test.js @@ -21,15 +21,15 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Realtime report with multiple metrics', () => { it('should run realtime with multiple metrics', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_realtime_report_with_multiple_metrics.js ${GA4_PROPERTY_ID}` + 'node ./run_realtime_report_with_multiple_metrics.js ' + + `${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report.test.js b/google-analytics-data/test/run_report.test.js index 5c98fc0..4a2adf7 100644 --- a/google-analytics-data/test/run_report.test.js +++ b/google-analytics-data/test/run_report.test.js @@ -21,13 +21,12 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('RunReport', () => { it('should run runReport', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync(`node ./run_report.js ${GA4_PROPERTY_ID}`); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_aggregations.test.js b/google-analytics-data/test/run_report_with_aggregations.test.js index efceb40..674adf7 100644 --- a/google-analytics-data/test/run_report_with_aggregations.test.js +++ b/google-analytics-data/test/run_report_with_aggregations.test.js @@ -21,15 +21,14 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Run report with aggregations', () => { it('should run report with aggregations', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_aggregations.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_aggregations.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_cohorts.test.js b/google-analytics-data/test/run_report_with_cohorts.test.js index 8fe5176..a7d2caf 100644 --- a/google-analytics-data/test/run_report_with_cohorts.test.js +++ b/google-analytics-data/test/run_report_with_cohorts.test.js @@ -21,15 +21,14 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Run report with cohorts', () => { it('should run report with cohorts', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_cohorts.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_cohorts.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_date_ranges.test.js b/google-analytics-data/test/run_report_with_date_ranges.test.js index 3915a23..db4ec09 100644 --- a/google-analytics-data/test/run_report_with_date_ranges.test.js +++ b/google-analytics-data/test/run_report_with_date_ranges.test.js @@ -21,15 +21,14 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Report with date ranges', () => { it('should run a report with date ranges', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_date_ranges.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_date_ranges.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_dimension_and_metric_filters.test.js b/google-analytics-data/test/run_report_with_dimension_and_metric_filters.test.js index 0c27422..f4756cb 100644 --- a/google-analytics-data/test/run_report_with_dimension_and_metric_filters.test.js +++ b/google-analytics-data/test/run_report_with_dimension_and_metric_filters.test.js @@ -21,15 +21,15 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Report with dimension and metric filters', () => { it('should run a report with dimension and metric filters', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_dimension_and_metric_filters.js ${GA4_PROPERTY_ID}` + 'node ./run_report_with_dimension_and_metric_filters.js ' + + `${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_dimension_exclude_filter.test.js b/google-analytics-data/test/run_report_with_dimension_exclude_filter.test.js index 674948f..1373539 100644 --- a/google-analytics-data/test/run_report_with_dimension_exclude_filter.test.js +++ b/google-analytics-data/test/run_report_with_dimension_exclude_filter.test.js @@ -21,15 +21,14 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Report with dimension exclude filter', () => { it('should run a report using a filter with `not_expression`', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_dimension_exclude_filter.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_dimension_exclude_filter.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_dimension_filter.test.js b/google-analytics-data/test/run_report_with_dimension_filter.test.js index 9a23290..5083fe6 100644 --- a/google-analytics-data/test/run_report_with_dimension_filter.test.js +++ b/google-analytics-data/test/run_report_with_dimension_filter.test.js @@ -21,15 +21,14 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Report with dimension filter', () => { it('should run a report with a dimension filter', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_dimension_filter.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_dimension_filter.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_dimension_in_list_filter.test.js b/google-analytics-data/test/run_report_with_dimension_in_list_filter.test.js index da9dacb..a6fa0b7 100644 --- a/google-analytics-data/test/run_report_with_dimension_in_list_filter.test.js +++ b/google-analytics-data/test/run_report_with_dimension_in_list_filter.test.js @@ -21,15 +21,16 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Report with dimension in list filter', () => { - it('should run a report using a dimension filter with `in_list_filter` expression.`', async () => { - // eslint-disable-next-line no-unused-vars + it('should run a report using a dimension filter with ' + + '`in_list_filter` expression.`', + async () => { const stdout = execSync( - `node ./run_report_with_dimension_in_list_filter.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_dimension_in_list_filter.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_multiple_dimension_filters.test.js b/google-analytics-data/test/run_report_with_multiple_dimension_filters.test.js index c7a335c..8e82533 100644 --- a/google-analytics-data/test/run_report_with_multiple_dimension_filters.test.js +++ b/google-analytics-data/test/run_report_with_multiple_dimension_filters.test.js @@ -21,15 +21,15 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Report with multiple dimension filters', () => { it('runs a report with dimension filters', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_multiple_dimension_filters.js ${GA4_PROPERTY_ID}` + 'node ./run_report_with_multiple_dimension_filters.js ' + + `${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_multiple_dimensions.test.js b/google-analytics-data/test/run_report_with_multiple_dimensions.test.js index 008358f..bee7723 100644 --- a/google-analytics-data/test/run_report_with_multiple_dimensions.test.js +++ b/google-analytics-data/test/run_report_with_multiple_dimensions.test.js @@ -21,15 +21,14 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Run Report With Multiple Dimensions', () => { it('should run runReportWithMultipleDimensions', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_multiple_dimensions.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_multiple_dimensions.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_multiple_metrics.test.js b/google-analytics-data/test/run_report_with_multiple_metrics.test.js index 5bbf0ae..d0cf6af 100644 --- a/google-analytics-data/test/run_report_with_multiple_metrics.test.js +++ b/google-analytics-data/test/run_report_with_multiple_metrics.test.js @@ -21,15 +21,14 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Run Report With Multiple Metrics', () => { it('should run runReportWithMultipleMetrics', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_multiple_metrics.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_multiple_metrics.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_named_date_ranges.test.js b/google-analytics-data/test/run_report_with_named_date_ranges.test.js index 3420b14..dc6ea94 100644 --- a/google-analytics-data/test/run_report_with_named_date_ranges.test.js +++ b/google-analytics-data/test/run_report_with_named_date_ranges.test.js @@ -21,15 +21,14 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Report with named date ranges', () => { it('runs a report using named date ranges', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_named_date_ranges.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_named_date_ranges.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_ordering.test.js b/google-analytics-data/test/run_report_with_ordering.test.js index 4ef56a8..b29a736 100644 --- a/google-analytics-data/test/run_report_with_ordering.test.js +++ b/google-analytics-data/test/run_report_with_ordering.test.js @@ -21,16 +21,18 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Report with ordering', () => { - it('should run a report of active users, ordered by descending revenue', async () => { - // eslint-disable-next-line no-unused-vars - const stdout = execSync( - `node ./run_report_with_ordering.js ${GA4_PROPERTY_ID}` - ); - assert.match(stdout, /Report result/); - }); + it( + 'should run a report of active users, ordered by ' + + 'descending revenue', + async () => { + const stdout = execSync( + `node ./run_report_with_ordering.js ${GA4_PROPERTY_ID}`, + ); + assert.match(stdout, /Report result/); + }); }); diff --git a/google-analytics-data/test/run_report_with_pagination.test.js b/google-analytics-data/test/run_report_with_pagination.test.js index be66e98..8c28613 100644 --- a/google-analytics-data/test/run_report_with_pagination.test.js +++ b/google-analytics-data/test/run_report_with_pagination.test.js @@ -21,15 +21,16 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Report with Pagination', () => { - it('should run a report several times, receiving portioned results with pagination', async () => { - // eslint-disable-next-line no-unused-vars + it('should run a report several times, receiving portioned ' + + 'results with pagination', + async () => { const stdout = execSync( - `node ./run_report_with_pagination.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_pagination.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Report result/); }); diff --git a/google-analytics-data/test/run_report_with_property_quota.test.js b/google-analytics-data/test/run_report_with_property_quota.test.js index 836bffd..1dfe6cc 100644 --- a/google-analytics-data/test/run_report_with_property_quota.test.js +++ b/google-analytics-data/test/run_report_with_property_quota.test.js @@ -21,15 +21,14 @@ const cp = require('child_process'); const {assert} = require('chai'); const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558'; describe('Report with property quota', () => { it('should run a report and print property quota information', async () => { - // eslint-disable-next-line no-unused-vars const stdout = execSync( - `node ./run_report_with_property_quota.js ${GA4_PROPERTY_ID}` + `node ./run_report_with_property_quota.js ${GA4_PROPERTY_ID}`, ); assert.match(stdout, /Tokens per day quota consumed/); });