Option 1: Client SDK (Recommended)
The easiest way to track impressions is using the ZeroClick Client SDK. Add the following script tag to your HTML:Configuration Attributes
-
data-target(optional): CSS selector for the element that should be watched for impressions- IMPORTANT: selector must return a single element which contains all chat messages
- Example:
#chat - Default
document.body
-
data-offer-id-regex(optional): Custom regex pattern to parse offer IDs from anchor linkhrefvalues- Useful when using custom URL structures - otherwise this should be omitted
- The regex should contain a capture group for the offer ID
- Example:
"/api/v1/offers/([^/?]+)"matcheshttps://example.com/api/v1/offers/abc-123 - Example:
"offer-(\d+)"matcheshttps://mycustomlink.com/offers/offer-123 - Example:
"offers/([a-zA-Z0-9-]+)"matcheshttps://example.com/offers/abc-123 - If not provided, the SDK will look for standard offer ID formats
Example Usage
Basic usage with standard offer links and target element:Option 2: Manual Tracking via API
For more control over impression tracking, you can manually call the tracking endpoint. This is useful when you’re already parsing tool call results server-side or need custom tracking logic or want fine grained control over the logic. Endpoint:POST https://mcp.zeroclick.ai/api/v1/offers/t
Request Body: