Contentsquare icon

Contentsquare

Use the Contentsquare API

Actions76

Overview

This node integrates with the Contentsquare API, specifically supporting multiple resources including the Data Export API. The "List Custom Variables" operation under the Data Export API resource retrieves all custom variables available on a specified project.

This node is useful for users who want to programmatically access and analyze custom variables defined in their Contentsquare projects. For example, marketing analysts or data engineers can use this node to fetch custom variable metadata to incorporate into dashboards, reports, or further automated workflows.

Properties

Name Meaning
Query Parameters A collection of optional filters and parameters to refine the API request. Includes:
- Device Filter by device type: All, Desktop, Mobile, Tablet
- End Date End date of the analysis range (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 (number)
- IDs Comma-separated list of segment IDs to filter results
- Limit Maximum number of results to return (minimum 1, default 50)
- Metric Type Metric calculation type: Quantile or Average
- Order Result ordering: Ascending or Descending
- Page Page number of results to retrieve
- Period Granularity of results: Daily or 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 for 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

Note: For the "List Custom Variables" operation, no specific required parameters are enforced beyond authentication and project context.

Output

The output is a JSON array where each item corresponds to an element returned by the Contentsquare API for the requested operation. For "List Custom Variables," the JSON will contain details about each custom variable available in the project, such as variable names, types, and possibly metadata describing their usage.

If the API returns no content, the node outputs a status code message indicating "204 No Content."

No binary data output is produced by this operation.

Dependencies

  • Requires valid Contentsquare API credentials including:
    • Client ID
    • Client Secret
    • Project ID (may be required depending on API key scope)
    • Scope string for OAuth token request
  • The node performs OAuth2 client credentials flow to obtain an access token.
  • Network access to https://api.contentsquare.com is necessary.
  • Proper configuration of the credential in n8n is required to authenticate API requests.

Troubleshooting

  • Missing Credentials: If Client ID or Client Secret is missing, the node throws an error "Missing Client ID or Client Secret."
  • Authentication Failure: Failure to retrieve an access token or endpoint URL from the OAuth token response results in errors "Failed to retrieve access token" or "Failed to retrieve endpoint."
  • Required Parameter Missing: Some operations require specific IDs (e.g., Job ID, Page Group ID). Omitting these causes explicit errors like "Job ID is required."
  • API Errors: Any HTTP or API errors during the request are caught and rethrown as "Error calling Contentsquare API" with the original message and stack trace.
  • Empty or Invalid Response: If the API returns empty or invalid JSON, the node attempts to parse it; if parsing fails, it returns raw text or a 204 status message.

To resolve issues:

  • Ensure all required credentials and parameters are provided.
  • Verify network connectivity and API endpoint availability.
  • Check that the API key has appropriate permissions for the requested resource.
  • Review error messages for hints on missing or invalid inputs.

Links and References

Discussion