Contentsquare icon

Contentsquare

Use the Contentsquare API

Actions76

Overview

This node integrates with the Contentsquare API to retrieve detailed user behavior and performance metrics. Specifically, the "List Segments" operation under the "Metrics API" resource fetches a list of all segments for a project, optionally filtered by various query parameters.

Use cases include:

  • Analyzing user segments to understand different visitor groups.
  • Filtering segments based on device type, date ranges, or other criteria.
  • Retrieving segment data to feed into dashboards or further analytics workflows.

For example, you might use this node to get all mobile user segments created in the last month or to limit results to a specific set of segment IDs.

Properties

Name Meaning
Device Device filter for analysis. Options: All, Desktop, Mobile, Tablet
End Date End of date range for analysis (must be after Start Date)
Format Start date of the query date range
Frequency Filter based on export frequency
From Filter based on export format
Goal ID Return conversion metrics for a non-ecommerce goal
IDs Filter results to segments matching these IDs (comma-separated)
Limit Maximum number of results to return (minimum 1, default 50)
Metric Type Metric calculation type. Options: Quantile, Average
Order Order of results list. Options: Ascending, Descending (default Descending)
Page Page number of results to retrieve
Period Granularity of results (only for date ranges > 1 day). Options: Daily, None
Project ID Target project ID (required only for account-level API key)
Quantile Percentile used if metric type is quantile (default 75)
Scope Filter based on scope
Segment IDs Multiple segments separated by commas to get intersection metrics
Start Date Beginning of date range for analysis (must be before End Date)
State Filter based on status
To End date of the query date range

Output

The output is a JSON array where each item represents a segment object returned by the Contentsquare Metrics API. The exact structure depends on the API response but typically includes segment identifiers, names, and associated metadata.

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.
  • Needs valid credentials configured in n8n for the Contentsquare API.
  • Network access to https://api.contentsquare.com is required.

Troubleshooting

  • Missing Credentials: If Client ID or Client Secret are not provided, the node throws an error indicating missing credentials.
  • Required Parameters Missing: Some operations require mandatory parameters like Page Group ID or Zone ID; absence will cause errors.
  • Access Token Retrieval Failure: If the OAuth token cannot be retrieved, the node will throw an error.
  • Invalid Query Parameters: Providing invalid or incorrectly formatted query parameters may result in API errors.
  • API Endpoint Errors: The node surfaces API errors with messages prefixed by "Error calling Contentsquare API". Check the stack trace for details.

To resolve issues:

  • Ensure all required credentials and parameters are correctly set.
  • Verify network connectivity and API endpoint availability.
  • Confirm that query parameters conform to expected formats and constraints.

Links and References

Discussion