Contentsquare icon

Contentsquare

Use the Contentsquare API

Actions76

Overview

This node integrates with the Contentsquare API to retrieve detailed web analytics and user behavior metrics. Specifically, the "Get Page Web Vitals" operation under the "Metrics API" resource fetches a list of web vitals metrics for a specified page group. These metrics include core web vitals that measure real-world user experience on web pages, such as loading performance, interactivity, and visual stability.

This node is beneficial for digital analysts, marketers, and developers who want to monitor and optimize website performance by accessing key user engagement and performance indicators programmatically. For example, it can be used to automate the retrieval of Core Web Vitals data for specific page groups to track improvements over time or to trigger alerts when performance degrades.

Properties

Name Meaning
Page Group ID The unique identifier of the page group for which to retrieve web vitals metrics. This is required to specify the target page group in the query.
Query Parameters A collection of optional filters and parameters to refine the data request:
- Device: Filter results by device type (All, Desktop, Mobile, Tablet).
- End Date: End date of the analysis range.
- Format: Format of the query date range.
- Frequency: Export frequency filter.
- From: Export format filter.
- Goal ID: Conversion goal identifier for non-ecommerce goals.
- IDs: Comma-separated list of segment IDs to filter.
- Limit: Maximum number of results to return (default 50).
- Metric Type: Choose between Quantile or Average metrics.
- Order: Sort order of results (Ascending or Descending).
- Page: Pagination page number.
- Period: Granularity of results (Daily or None).
- Project ID: Target project identifier (required for account-level API keys).
- Quantile: Percentile value for quantile metrics (default 75).
- Scope: Scope filter.
- Segment IDs: Multiple segments separated by commas for intersection filtering.
- Start Date: Start date of the analysis range.
- State: Status filter.
- To: End date of the query date range.

Output

The output JSON contains the response from the Contentsquare Metrics API endpoint for page web vitals. It typically includes an array of web vital metrics related to the specified page group, such as:

  • Loading times (e.g., Largest Contentful Paint)
  • Interactivity measures (e.g., First Input Delay)
  • Visual stability metrics (e.g., Cumulative Layout Shift)
  • Other custom or core web vitals provided by Contentsquare

The exact structure depends on the API response but generally consists of metric names, values, timestamps, and possibly segmentation details.

No binary data output is produced by this operation.

Dependencies

  • Requires an API authentication token obtained via OAuth2 client credentials flow using:
    • Client ID
    • Client Secret
    • Optional Project ID and Scope
  • The node makes HTTP requests to the Contentsquare API endpoints.
  • Proper n8n credentials configuration is necessary to store and provide these authentication details securely.

Troubleshooting

  • Missing Client ID or Client Secret: The node will throw an error if these credentials are not set. Ensure your API credentials are correctly configured in n8n.
  • Missing Required Parameters: For this operation, the "Page Group ID" must be provided; otherwise, an error is thrown.
  • Failed to Retrieve Access Token or Endpoint: If the OAuth token request fails, check network connectivity, credential validity, and API availability.
  • API Errors: Any API call failure will result in an error message prefixed with "Error calling Contentsquare API". Check the error description for details.
  • Invalid Query Parameters: Ensure dates are valid and in correct order (startDate before endDate), numeric fields are numbers, and enumerated options are valid.
  • Empty or Unexpected Response: If the API returns no content or unexpected data, verify the query parameters and the existence of data for the specified page group.

Links and References

Discussion