API Prompts for AI Assistants
Copy-paste these prompts into your AI coding assistant (Cursor, Lovable, Replit, Windsurf, ChatGPT, Claude, etc.) to build integrations with the Zenovay API. Each prompt is self-contained with full endpoint details and response schemas.
Replace the placeholders before pasting: [YOUR_API_KEY], [YOUR_WEBSITE_ID], and [YOUR_TRACKING_CODE]. Find these in your Zenovay Dashboard under Settings.
1. Real-Time Visitor Counter Widget
Build a live visitor counter that updates every 10 seconds. Uses the public endpoint -- no API key needed.
Build me a real-time visitor counter widget for my website.
Use the Zenovay public live visitor endpoint:
- Method: GET
- URL: https://api.zenovay.com/e/live/[YOUR_TRACKING_CODE]
- Authentication: None required (public endpoint)
- Response format: { "visitors": 42 }
Requirements:
1. Display the current number of live visitors on the site
2. Show a green pulsing dot next to the count to indicate "live"
3. Auto-refresh every 10 seconds using setInterval
4. Show "-- visitors online" while loading
5. Handle fetch errors gracefully (keep showing last known count)
6. Use clean, minimal styling -- a small pill-shaped badge
7. The text should say "{count} visitor online" (singular) or "{count} visitors online" (plural)
8. Add a subtle fade animation when the number changes
This endpoint returns the number of visitors currently active on my site (within the last 5 minutes). It's a public endpoint so it's safe to call directly from client-side JavaScript.
Build this as a standalone component I can drop into any page.2. Traffic Overview Dashboard
Build a full analytics dashboard with visitor charts and summary stats.
Build me a traffic overview analytics dashboard using the Zenovay External API.
API Details:
- Base URL: https://api.zenovay.com/api/external/v1
- Authentication: Header "X-API-Key: [YOUR_API_KEY]"
- My Website ID: [YOUR_WEBSITE_ID]
IMPORTANT: Never expose the API key in client-side code. Create a server-side proxy endpoint (e.g., /api/analytics) that forwards requests to Zenovay with the API key, and have the frontend call your proxy instead.
Endpoint to use:
GET https://api.zenovay.com/api/external/v1/analytics/[YOUR_WEBSITE_ID]?range=7d
Query parameter "range" accepts: 24h, 7d, 30d, 90d, 1y (default: 7d)
Response envelope:
{
"success": true,
"data": {
"website": { "id": "...", "domain": "...", "name": "..." },
"time_range": "7d",
"date_range": { "start": "2026-01-31", "end": "2026-02-07" },
"summary": {
"total_visitors": 12543,
"total_page_views": 45231,
"unique_visitors": 8920
},
"daily_stats": [
{
"date": "2026-01-31",
"total_visitors": 1823,
"page_views": 6542,
"unique_visitors": 1290
}
]
},
"timestamp": "2026-02-07T12:00:00.000Z"
}
Dashboard requirements:
1. Summary cards at top showing: Total Visitors, Page Views, Unique Visitors
2. A line or bar chart showing daily page_views and unique_visitors over the selected period
3. A time range selector (24h, 7d, 30d, 90d) that refetches data when changed
4. Loading skeleton states while data is being fetched
5. Error state with retry button if the API call fails
6. Responsive layout that works on mobile
Use the daily_stats array for the chart data. The date field is in YYYY-MM-DD format.3. Revenue Attribution Display
Build a revenue tracking view using analytics and visitor data.
Build a revenue attribution display that shows which traffic sources and pages drive the most valuable visitors using the Zenovay External API.
API Details:
- Base URL: https://api.zenovay.com/api/external/v1
- Authentication: Header "X-API-Key: [YOUR_API_KEY]"
- My Website ID: [YOUR_WEBSITE_ID]
IMPORTANT: Never expose the API key in client-side code. Create a server-side proxy.
Endpoints to use:
1. GET /analytics/[YOUR_WEBSITE_ID]/visitors?range=30d&limit=100
Response:
{
"success": true,
"data": {
"visitors": [
{
"id": "vis_abc123",
"country_code": "US",
"country_name": "United States",
"city": "San Francisco",
"device_type": "desktop",
"browser": "Chrome",
"os": "macOS",
"value_score": 87,
"visited_at": "2026-02-01T10:00:00Z",
"landing_page": "/pricing",
"referrer": "https://google.com",
"had_interaction": true
}
],
"pagination": { "limit": 100, "offset": 0, "has_more": true }
}
}
2. GET /analytics/[YOUR_WEBSITE_ID]/pages?range=30d&limit=20
Response:
{
"success": true,
"data": {
"pages": [
{ "url": "/pricing", "views": 2134, "avg_value_score": 72.5 }
]
}
}
Build a dashboard that shows:
1. Top pages ranked by avg_value_score (highest value pages)
2. A table of high-value visitors (value_score > 60) showing their country, landing page, referrer, and device
3. Referrer breakdown -- group visitors by referrer domain, show count and average value_score per source
4. A bar chart of value_score distribution (e.g., 0-20, 21-40, 41-60, 61-80, 81-100)
5. Filter by date range (24h, 7d, 30d)
The value_score field (0-100) indicates how engaged/valuable each visitor is. Higher scores mean more engaged visitors.4. Geographic Visitor Map
Build an interactive world map showing where visitors come from.
Build an interactive geographic map that visualizes where my website visitors come from using the Zenovay External API.
API Details:
- Base URL: https://api.zenovay.com/api/external/v1
- Authentication: Header "X-API-Key: [YOUR_API_KEY]"
- My Website ID: [YOUR_WEBSITE_ID]
IMPORTANT: Never expose the API key in client-side code. Create a server-side proxy.
Endpoint:
GET https://api.zenovay.com/api/external/v1/analytics/[YOUR_WEBSITE_ID]/countries?range=30d
Response:
{
"success": true,
"data": {
"countries": [
{
"country_code": "US",
"country_name": "United States",
"visitors": 4521,
"avg_value_score": 65.3
},
{
"country_code": "GB",
"country_name": "United Kingdom",
"visitors": 1823,
"avg_value_score": 58.1
},
{
"country_code": "DE",
"country_name": "Germany",
"visitors": 1456,
"avg_value_score": 52.7
}
]
}
}
The country_code field uses ISO 3166-1 alpha-2 format (US, GB, DE, etc.).
Requirements:
1. Display an interactive world map (use react-simple-maps or a similar library)
2. Color each country based on visitor count -- darker shading = more visitors
3. Show a tooltip on hover with: country name, visitor count, and percentage of total
4. Display a sorted table below the map with all countries, their visitor count, percentage, and avg_value_score
5. Add a time range selector (24h, 7d, 30d, 90d)
6. Include a color legend showing what the shading means
7. Handle countries with zero visitors (leave them in default/light color)
8. Responsive design -- table below map on mobile5. UTM Campaign Performance Tracker
Build a campaign tracking table from visitor referrer data.
Build a UTM campaign performance tracker using the Zenovay External API to analyze which traffic sources and campaigns drive the most visitors.
API Details:
- Base URL: https://api.zenovay.com/api/external/v1
- Authentication: Header "X-API-Key: [YOUR_API_KEY]"
- My Website ID: [YOUR_WEBSITE_ID]
IMPORTANT: Never expose the API key in client-side code. Create a server-side proxy.
Endpoint:
GET https://api.zenovay.com/api/external/v1/analytics/[YOUR_WEBSITE_ID]/visitors?range=30d&limit=1000
Response:
{
"success": true,
"data": {
"visitors": [
{
"id": "vis_abc123",
"country_code": "US",
"country_name": "United States",
"device_type": "desktop",
"value_score": 87,
"visited_at": "2026-02-01T10:00:00Z",
"landing_page": "/pricing?utm_source=google&utm_medium=cpc&utm_campaign=spring",
"referrer": "https://google.com/search",
"had_interaction": true
}
],
"pagination": { "limit": 1000, "offset": 0, "has_more": false }
}
}
If more visitors exist, paginate using the "offset" query parameter.
Requirements:
1. Parse UTM parameters from the landing_page field (utm_source, utm_medium, utm_campaign)
2. Also parse the referrer field to extract the referring domain
3. Build a table showing each traffic source with columns:
- Source (utm_source or referrer domain)
- Medium (utm_medium or "referral"/"direct")
- Campaign (utm_campaign if present)
- Visitors (count)
- Avg Value Score (average value_score for that source)
- Interaction Rate (percentage with had_interaction=true)
4. Sort by visitor count descending by default, but make columns sortable
5. Add a search/filter input to filter by source name
6. Group "direct" traffic (no referrer and no UTM) into a "Direct" row
7. Show a pie chart or horizontal bar chart of top 5 sources
8. Time range selector (7d, 30d, 90d)
For pagination: if has_more is true, make additional requests incrementing the offset by the limit each time until has_more is false.6. Custom Event Tracking Implementation
Implement custom event tracking using the Zenovay tracking script.
Help me implement custom event tracking on my website using Zenovay Analytics.
My tracking code is: [YOUR_TRACKING_CODE]
Zenovay Tracking Script (already installed on my site):
<script defer data-tracking-code="[YOUR_TRACKING_CODE]" src="https://api.zenovay.com/z.js"></script>
The tracking script exposes a global function for custom events:
window.zenovay('track', eventName, eventData)
Alternatively, you can send events directly via the tracking API:
- Method: POST
- URL: https://api.zenovay.com/e/[YOUR_TRACKING_CODE]
- Content-Type: application/json
- Body: {
"type": "event",
"name": "event_name",
"data": { "key": "value" },
"url": "https://example.com/current-page"
}
- No authentication needed (uses the tracking code for identification)
Implement tracking for these events on my website:
1. **Button Clicks**: Track when users click CTA buttons
- Event name: "cta_click"
- Data: { button_text, button_location, page_url }
2. **Form Submissions**: Track when forms are submitted
- Event name: "form_submit"
- Data: { form_id, form_name, page_url }
- Do NOT track any personally identifiable form field values
3. **Purchase/Checkout**: Track completed purchases
- Event name: "purchase"
- Data: { order_id, revenue, currency, items_count }
4. **Scroll Depth**: Track how far users scroll on key pages
- Event name: "scroll_depth"
- Data: { depth_percent (25, 50, 75, 100), page_url }
- Only fire each threshold once per page view
5. **File Downloads**: Track when users download files
- Event name: "file_download"
- Data: { file_name, file_type, page_url }
Create a reusable utility module that:
- Checks if the Zenovay script is loaded before sending events
- Queues events if the script hasn't loaded yet
- Provides typed functions for each event type
- Handles errors silently (analytics should never break the site)7. Setting Up the Zenovay Tracking Script
Extended setup prompt covering installation, verification, and custom event configuration.
Help me set up Zenovay Analytics tracking on my website from scratch.
My tracking code is: [YOUR_TRACKING_CODE]
STEP 1: INSTALL THE TRACKING SCRIPT
Add this script to the <head> section of every page (or the root layout):
<script defer data-tracking-code="[YOUR_TRACKING_CODE]" src="https://api.zenovay.com/z.js"></script>
For React/Next.js, use the Script component:
import Script from 'next/script'
<Script src="https://api.zenovay.com/z.js" data-tracking-code="[YOUR_TRACKING_CODE]" strategy="afterInteractive" />
For Vue, add to public/index.html or App.vue.
For plain HTML, add before </head> in index.html.
STEP 2: VERIFY TRACKING IS WORKING
After installing, verify it works:
1. Open your site in a browser
2. Open DevTools (F12) > Console
3. You should see: "[Zenovay] Script executing..."
4. For more detail, add data-debug="true" to the script tag
5. Check the Zenovay dashboard at https://app.zenovay.com -- your site should show live visitors within a few seconds
To verify programmatically, fetch the live endpoint:
GET https://api.zenovay.com/e/live/[YOUR_TRACKING_CODE]
Response: { "visitors": 1 }
If visitors > 0 after you visit your site, tracking is working.
STEP 3: CONFIGURE CUSTOM EVENTS
The script exposes a global function:
window.zenovay('track', 'event_name', { key: 'value' })
Set up these common events:
- Page-specific tracking is automatic (no setup needed)
- Outbound link clicks are tracked automatically
- For custom events (button clicks, form submits, purchases), use the window.zenovay() function
Example for tracking a button click:
document.getElementById('cta-button').addEventListener('click', () => {
window.zenovay('track', 'cta_click', { button: 'hero-signup', page: window.location.pathname });
});
STEP 4: OPTIONAL -- FIRST-PARTY PROXY
For bypassing ad blockers, set up a proxy rewrite:
- Rewrite /api/_z/* to https://api.zenovay.com/fp/*
- Change script src to /api/_z/script.js?id=[YOUR_TRACKING_CODE]
Please install the script for my specific framework, verify it's working, and set up basic custom event tracking for button clicks and form submissions.8. Weekly Analytics Email Digest
Build a script that sends a weekly analytics summary email.
Build a weekly analytics email digest script that fetches my website analytics from the Zenovay API and sends a formatted HTML email summary.
API Details:
- Base URL: https://api.zenovay.com/api/external/v1
- Authentication: Header "X-API-Key: [YOUR_API_KEY]"
- My Website ID: [YOUR_WEBSITE_ID]
Endpoints to fetch:
1. GET /analytics/[YOUR_WEBSITE_ID]?range=7d
Response: {
"success": true,
"data": {
"summary": { "total_visitors": 12543, "total_page_views": 45231, "unique_visitors": 8920 },
"daily_stats": [{ "date": "2026-01-31", "total_visitors": 1823, "page_views": 6542, "unique_visitors": 1290 }]
}
}
2. GET /analytics/[YOUR_WEBSITE_ID]/pages?range=7d&limit=10
Response: {
"success": true,
"data": {
"pages": [{ "url": "/", "views": 5423, "avg_value_score": 45.2 }]
}
}
3. GET /analytics/[YOUR_WEBSITE_ID]/countries?range=7d&limit=5
Response: {
"success": true,
"data": {
"countries": [{ "country_code": "US", "country_name": "United States", "visitors": 4521, "avg_value_score": 65.3 }]
}
}
4. GET /analytics/[YOUR_WEBSITE_ID]?range=7d (for current week)
GET /analytics/[YOUR_WEBSITE_ID]?range=30d (to calculate previous week baseline)
Build a Node.js (or Python) script that:
1. Fetches all 3 endpoints above (in parallel for speed)
2. Also fetches the previous week's data to calculate week-over-week changes
3. Formats an HTML email containing:
- Subject line: "Weekly Analytics Report -- {domain} -- {date range}"
- Summary section: Total Visitors, Page Views, Unique Visitors with week-over-week % change (green arrow up / red arrow down)
- A simple ASCII or inline-CSS bar chart showing daily visitors for the week
- Top 10 Pages table: URL, Views, Avg Value Score
- Top 5 Countries table: Country, Visitors, Percentage
- Footer with link to full dashboard at https://app.zenovay.com
4. Sends the email using Resend (npm: resend) or nodemailer with SMTP
5. Designed to run as a cron job every Monday at 9:00 AM
Environment variables needed:
- ZENOVAY_API_KEY: Your API key
- ZENOVAY_WEBSITE_ID: Your website ID
- EMAIL_TO: Recipient email address
- RESEND_API_KEY: Resend API key (or SMTP credentials)
- EMAIL_FROM: Sender address (e.g., [email protected])
Include a package.json with dependencies and a crontab entry:
0 9 * * 1 cd /path/to/script && node digest.js
Make the email look professional with inline CSS (email clients don't support external stylesheets). Use a clean, minimal design.Tips for Using These Prompts
- Replace all placeholders before pasting -- look for
[YOUR_API_KEY],[YOUR_WEBSITE_ID], and[YOUR_TRACKING_CODE] - Never hardcode API keys in client-side code. All prompts that use the API key recommend a server-side proxy
- Test with small date ranges first (
24h) to verify your integration works before scaling up - Check rate limits -- Free plan allows 10 requests/minute, Pro allows 30. See Rate Limits
- The live visitor endpoint (prompt 1) is public and free to use directly from the browser
Related Guides
- AI Integration Prompts -- Prompts for installing the tracking script
- Getting Started with the API -- API key setup and authentication
- Building a Custom Dashboard -- Step-by-step dashboard guide
- External API Reference -- Full endpoint documentation