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 Views" operation under the "Metrics API" resource fetches the number of times a particular page (identified by a Page Group ID) was viewed within a specified date range and other optional filters.

Use cases include:

  • Analyzing page popularity by counting views.
  • Monitoring traffic trends over time for specific pages.
  • Filtering page views by device type or segments to understand audience behavior.

For example, a digital marketer could use this node to get the total page views for a landing page during a campaign period, segmented by mobile vs desktop users.

Properties

Name Meaning
Page Group ID Numeric identifier of the page group for which to retrieve metrics. This is required to specify the target page.
Query Parameters A collection of optional filters and settings to refine the query:
- Device: Filter by device type (all, desktop, mobile, tablet).
- Start Date / End Date: Define the date range for analysis.
- Limit: Maximum number of results to return (default 50).
- Metric Type: Choose between Quantile or Average metric calculations.
- Order: Sort results ascending or descending.
- Page: Pagination page number.
- Period: Granularity of results (daily or none).
- Other parameters like goalId, segmentIds, projectId, etc., allow further filtering based on goals, segments, projects, and more.

Output

The output is a JSON array where each item corresponds to the API response data for the requested page views metric. The structure depends on the API's response but generally includes counts of page views and possibly metadata about the query.

If the API returns no content, the node outputs an object indicating "Status Code": "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 performs OAuth2 client credentials flow to obtain an access token from Contentsquare.
  • 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 set.
  • Failed to retrieve access token or endpoint: Indicates issues with authentication or API availability.
  • Required parameter missing: For this operation, the Page Group ID must be provided; otherwise, an error is thrown.
  • API errors: Any HTTP or API errors are wrapped and reported as node API errors with descriptive messages.
  • Empty or malformed responses: The node attempts to parse string responses as JSON; if parsing fails, it returns raw text.

To resolve common issues:

  • Ensure all required credentials and parameters are correctly set.
  • Verify network connectivity and API service status.
  • Check that the Page Group ID corresponds to a valid page group in your Contentsquare account.

Links and References

Discussion