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 web pages. Specifically, the "Get Page Visits" operation under the "Metrics API" resource fetches the number of sessions where a particular page has been viewed at least once.

Use cases include:

  • Analyzing how many visits a specific page group receives over a given time period.
  • Filtering visits by device type or other query parameters to understand audience segmentation.
  • Monitoring traffic trends for specific pages to optimize content or UX.

Example: A marketing analyst can use this node to pull the number of visits for a landing page during a campaign period, filtered by mobile devices, to evaluate campaign effectiveness.

Properties

Name Meaning
Page Group ID The identifier of the page group for which to retrieve visit metrics. This is required to specify the target page group.
Query Parameters Optional filters and settings for the query. Includes:
- Device: Filter by device type (All, Desktop, Mobile, Tablet).
- Start Date / End Date: Define date range.
- Limit: Max results to return.
- Metric Type: Quantile or Average.
- Order: Ascending or Descending.
- Period: Granularity (Daily or None).
- Other optional filters like Goal ID, Segment IDs, Project ID, etc.

The full list of query parameters includes device filtering, date ranges, pagination, ordering, metric types, and more, allowing flexible and precise data retrieval.

Output

The output is a JSON array containing the response from the Contentsquare Metrics API endpoint for page visits. The structure depends on the API's response but generally includes metrics such as:

  • Number of visits (sessions) where the specified page group was seen.
  • Additional metadata depending on query parameters (e.g., breakdowns by date if period is daily).

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

No binary data output is involved in this operation.

Dependencies

  • Requires an API key credential with client ID, client secret, project ID, and scope configured in n8n credentials.
  • The node authenticates via OAuth2 client credentials grant to obtain an access token before making API requests.
  • Network access to https://api.contentsquare.com is necessary.

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.
  • Missing Required Parameters: For this operation, "Page Group ID" must be provided; otherwise, an error is thrown.
  • Failed to Retrieve Access Token or Endpoint: Indicates issues with authentication or API availability.
  • API Errors: Any HTTP or API errors are wrapped and reported with messages prefixed by "Error calling Contentsquare API".
  • Empty Responses: If the API returns no data, the node outputs a 204 status message. Verify your query parameters and date ranges.

Links and References


This summary focuses on the "Metrics API" resource and the "Get Page Visits" operation as requested.

Discussion