Contentsquare icon

Contentsquare

Use the Contentsquare API

Actions76

Overview

This node integrates with the Contentsquare API to retrieve detailed site metrics data. Specifically, the "List Site Metrics" operation fetches various aggregated metrics about a website's user behavior and performance over a specified date range. This is useful for digital analysts, marketers, and product managers who want to monitor key performance indicators such as bounce rate, conversion rate, revenue, visits, and session times.

Typical use cases include:

  • Monitoring overall site health and user engagement trends.
  • Analyzing conversion rates and revenue performance.
  • Comparing metrics across different devices or segments.
  • Automating reporting workflows by fetching metrics programmatically.

For example, you could use this node to get the site's bounce rate and conversion rate between two dates filtered by device type, then trigger alerts or update dashboards based on the results.

Properties

Name Meaning
Device Filter metrics by device type. Options: All, Desktop, Mobile, Tablet.
End Date End of the date range for analysis (must be after Start Date). Format: string representing a date.
Format Format filter for the query (usage context not explicitly defined in code).
Frequency Filter based on export frequency (usage context not explicitly defined in code).
From Filter based on export format (usage context not explicitly defined in code).
Goal ID Numeric ID to return conversion metrics for a non-ecommerce goal.
IDs Comma-separated list of segment IDs to filter results matching these segments.
Limit Maximum number of results to return. Default is 50. Minimum value is 1.
Metric Type Type of metric aggregation. Options: Quantile (default), Average. Quantile defaults to 75th percentile unless overridden.
Order Order of results list. Options: Ascending, Descending (default).
Page Page number of results to retrieve (for pagination).
Period Granularity of results. Options: Daily, None (default). Can only be used if date range is larger than one day.
Project ID Target project ID (required only for account-level API keys).
Quantile Percentile value used when Metric Type is Quantile. Defaults to 75. Ignored if Metric Type is Average.
Scope Filter based on scope (usage context not explicitly defined in code).
Segment IDs Numeric ID(s) specifying multiple segments separated by commas to retrieve metrics for their intersection.
Start Date Beginning of date range for analysis (must be before End Date). Format: string representing a date.
State Filter based on status (usage context not explicitly defined in code).
To End date of the query date range (seems redundant with End Date; usage context unclear).

Output

The node outputs an array of JSON objects representing the response from the Contentsquare Metrics API for site metrics. The structure depends on the specific metrics requested but generally includes fields such as:

  • Metric names and values (e.g., bounce rate, conversion rate, revenue).
  • Time series data if granularity ("period") is set to daily.
  • Pagination metadata if applicable.

If the API returns no content, the output will indicate a "204 No Content" status.

No binary data output is produced by this operation.

Dependencies

  • Requires an API authentication token obtained via OAuth2 client credentials flow using a Client ID and Client Secret.
  • The node expects valid credentials configured in n8n containing at least:
    • Client ID
    • Client Secret
    • Optional Project ID and Scope
  • Network access to https://api.contentsquare.com is required.

Troubleshooting

  • Missing Credentials: If Client ID or Client Secret are missing, the node throws an error indicating these are required.
  • Required Parameters Missing: For this operation, no explicit required parameters are enforced by the code, but providing a valid date range (startDate and endDate) is necessary for meaningful results.
  • API Token Retrieval Failure: If the OAuth token cannot be retrieved, the node throws an error indicating failure to obtain the access token or endpoint.
  • Invalid Parameter Values: Passing invalid or empty required IDs (like Project ID for account-level keys) may cause API errors.
  • Empty or Malformed Response: The node attempts to parse JSON responses; if parsing fails, it returns raw text or a 204 status message.
  • Network Issues: Connectivity problems to the API endpoint will result in request errors.

To resolve common issues:

  • Ensure all required credentials and parameters are correctly set.
  • Verify date ranges are valid and formatted properly.
  • Check network connectivity and API availability.
  • Review error messages for specific missing parameters.

Links and References

Discussion