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 Visits" operation under the "Metrics API" resource fetches the number of sessions (site visits) within a specified date range and other optional filters.

Use cases include:

  • Analyzing traffic trends over time for a website.
  • Filtering visits by device type or segments to understand audience composition.
  • Monitoring site engagement and performance metrics for marketing or UX optimization.

For example, you could use this node to get the total number of visits to your site in the last month filtered by mobile devices, helping you tailor mobile experiences.

Properties

Name Meaning
Device Filter visits by device type: All, Desktop, Mobile, Tablet
End Date End of the date range for analysis (must be after Start Date)
Format Format filter for the query (specific usage depends on API)
Frequency Filter based on export frequency
From Filter based on export format
Goal ID 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 (minimum 1, default 50)
Metric Type Metric calculation type: Quantile or Average
Order Sort order of results: Ascending or Descending
Page Page number of results to retrieve
Period Granularity of results: Daily or None (only for date ranges larger than one day)
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 (similar to End Date)

Output

The output JSON contains the response from the Contentsquare Metrics API endpoint for site visits. This typically includes data such as:

  • Number of sessions (visits) matching the query parameters.
  • Possibly additional metadata like pagination info depending on the request.

If the API returns binary data (not typical for this operation), it would represent raw data exports or reports, but for "Get Site Visits," the output is standard JSON metrics data.

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 with these details.
  • Network access to https://api.contentsquare.com is required.
  • Proper project ID and any necessary permissions/scopes must be set in the API credentials.

Troubleshooting

  • Missing Client ID or Client Secret: The node will throw an error if these are not provided in credentials.
  • Failed to retrieve access token or endpoint: Indicates issues with authentication; verify credentials and network connectivity.
  • Required parameter missing errors: For example, "Page Group ID is required" or "Zone ID is required" if those are needed for other operations. For "Get Site Visits," ensure required parameters like date range are correctly set.
  • API errors: The node surfaces API error messages; check the message and stack trace for details.
  • Empty or unexpected responses: Verify that query parameters are correct and that the API has data for the requested filters.

Links and References

Discussion