Contentsquare icon

Contentsquare

Use the Contentsquare API

Actions76

Overview

This node integrates with the Contentsquare API to retrieve detailed metrics about user behavior and site performance. Specifically, the "Get Site Cart Average" operation fetches the average cart amount on a website, calculated by dividing the total revenue by the number of transactions. This metric is useful for e-commerce analytics to understand average purchase values.

Common scenarios where this node is beneficial include:

  • E-commerce performance analysis to monitor average cart value trends.
  • Marketing optimization by correlating cart averages with campaigns or segments.
  • Business intelligence dashboards that track key sales metrics over time.

Example: An online retailer can use this node to automatically pull the average cart value for a given date range and device type, helping them evaluate the effectiveness of promotions or changes in user behavior.

Properties

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

These properties allow fine-tuning the query to the Contentsquare Metrics API to retrieve the desired data slice.

Output

The output is a JSON array containing the response from the Contentsquare Metrics API for the site cart average metric. The structure depends on the API response but typically includes fields such as:

  • The average cart amount value.
  • Associated metadata like date ranges, device types, or segments if specified.
  • Pagination info if multiple pages are requested.

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 an API authentication token obtained via OAuth2 client credentials flow using a Client ID and Client Secret.
  • Needs a valid project ID and appropriate API scopes configured in the Contentsquare platform.
  • The node uses HTTP requests to the Contentsquare API endpoint.
  • Requires configuration of an API key credential in n8n with the necessary client credentials and project details.

Troubleshooting

  • Missing Client ID or Client Secret: The node will throw an error if these credentials are not provided. Ensure your API credentials are correctly set up.
  • Failed to retrieve access token or endpoint: Indicates issues with authentication or API availability. Verify credentials and network connectivity.
  • Required parameters missing: For example, if a required parameter like Page Group ID or Zone ID is missing for other operations, the node throws an error. For this operation, ensure date ranges and other filters are valid.
  • API errors: Any API call failure will result in an error with the message prefixed by "Error calling Contentsquare API". Check the API response and adjust parameters accordingly.
  • Empty or unexpected responses: If the API returns empty data, verify the query parameters and date ranges.

Links and References

Discussion