Contentsquare icon

Contentsquare

Use the Contentsquare API

Actions76

Overview

This node integrates with the Contentsquare API to retrieve detailed user behavior and performance metrics related to website zones, pages, sites, and exports. Specifically, for the Metrics API resource and the Get Zone Exposure Rate operation, it fetches the exposure rate metric of a specified zone on a webpage.

The Zone Exposure Rate metric represents how much time users spend exposed to (viewing) a particular zone on a page relative to other interactions or total visit time. This is useful for understanding user attention and engagement with specific page elements.

Common Use Cases

  • Measuring how long visitors are exposed to key areas like banners, ads, or product sections.
  • Comparing exposure rates across different devices or segments to optimize layout.
  • Tracking changes in exposure after UI updates or A/B tests.
  • Integrating exposure data into dashboards or reports for marketing and UX teams.

Practical Example

You want to analyze the exposure rate of a promotional banner zone on your homepage over the last month, filtered by mobile device users only. Using this node, you provide the zone ID and set query parameters for date range and device type. The node returns the exposure rate metric, which you can use to assess banner visibility and effectiveness.


Properties

Name Meaning
Zone ID Numeric identifier of the zone for which to retrieve the exposure rate metric. This is required.
Query Parameters Collection of optional filters and settings to refine the metric query:
- Device Filter results by device type: All, Desktop, Mobile, or Tablet. Default is All.
- End Date End date of the analysis period (must be after Start Date). Format as string (e.g., "YYYY-MM-DD").
- Format Format of the query date range (string).
- Frequency Filter based on export frequency (string).
- From Filter based on export format (string).
- Goal ID Numeric ID to return conversion metrics for a non-ecommerce goal.
- IDs Comma-separated list of segment IDs to filter results.
- Limit Maximum number of results to return (number, minimum 1). Default is 50.
- Metric Type Metric calculation type: Quantile or Average. Default is Quantile.
- Order Sort order of results: Ascending or Descending. Default is Descending.
- Page Page number of results to retrieve (for pagination).
- Period Granularity of results: Daily or None. Can only be used if date range is larger than one day. Default is None.
- Project ID Target project ID (required only for account-level API keys).
- Quantile Percentile value used if Metric Type is Quantile (ignored if Average). Default is 75.
- Scope Filter based on scope (string).
- Segment IDs Numeric segment IDs separated by commas to get metrics for their intersection.
- Start Date Start date of the analysis period (must be before End Date). Format as string (e.g., "YYYY-MM-DD").
- State Filter based on status (string).
- To End date of the query date range (string).

Output

The node outputs an array of JSON objects representing the response from the Contentsquare Metrics API for the zone exposure rate request.

  • The exact structure depends on the API response but typically includes fields such as:

    • The exposure rate metric value(s) for the specified zone.
    • Associated metadata like timestamps, device types, segments, or quantiles if requested.
  • If the API returns no content, the output will indicate a "204 No Content" status.

  • The node does not output binary data.


Dependencies

  • Requires an active Contentsquare API credential with:

    • Client ID
    • Client Secret
    • Optional Project ID and Scope
  • The node performs OAuth2 client credentials flow to obtain an access token before making API requests.

  • Network access to https://api.contentsquare.com is required.

  • Proper configuration of the credential in n8n is necessary to authenticate successfully.


Troubleshooting

Common Issues

  • Missing Credentials: If Client ID or Client Secret is not provided, the node throws an error indicating missing credentials.
  • Invalid or Expired Token: Failure to retrieve an access token will cause the node to error out.
  • Required Parameter Missing: For this operation, if the Zone ID is not provided, the node throws an error stating that Zone ID is required.
  • API Endpoint Errors: Any HTTP errors returned by the Contentsquare API will be wrapped and reported as node API errors.

Error Messages and Resolutions

  • "Missing Client ID or Client Secret." — Ensure the API credentials are correctly configured in n8n.
  • "Failed to retrieve access token" — Check network connectivity and validity of credentials.
  • "Failed to retrieve endpoint" — Verify the API base URL is accessible and correct.
  • "Zone ID is required" — Provide a valid numeric Zone ID in the node parameters.
  • "Error calling Contentsquare API: <message>" — Review the message for details; may indicate invalid parameters or API limits.

Links and References

Discussion