Create Project Goal — API Reference
Method-: POST
https://pagesense.zoho.com/pagesense/rest/v1/portal/{portal_name}/projectgoals/{linkname}
Scope required
PageSense.goals.CREATE
Purpose / Description
Creates a new goal under a specific project.
Typical goal types: time-spent, element interaction, link click, and custom-event based goals.
Use this endpoint when you want the system to start tracking a measurable conversion (goal) for a project.
Request
URL parameters
portal_name (path) — your portal identifier.
linkname (path) — project linkname (project-specific namespace in the URL).
Field notes / validation (must-haves & behavior)
projectgoal.display_name — string, required. Human-readable name. Keep it descriptive (used in reports).
projectgoal.goal_type — integer, required. Enumerated goal type (e.g., time-spent, element click, link click).
projectgoal.project_linkname — string, required. The project identifier (same value as {linkname} in path, but include it in body for safety).
projectgoal.goal_url — string, optional. If the goal is tied to a specific page or URL.
projectgoal.include_urls / exclude_urls — array[string], optional. URL filters for goal scope.
projectgoal.url — array[object], optional. URL matching rules — example object: { "match_type": 1 }.
projectgoal.time_threshold — integer (seconds), conditional. Required for time-spent goals. Value is in seconds (e.g., 30 = 30s).
Request body (JSON)
Copiedcurl -X POST "https://pagesense.zoho.com/pagesense/rest/v1/portal/my-portal/projectgoals/website-performance-project" \
-H "Authorization: Zoho-oauthtoken {access_token}
-H "Content-Type: application/json" \
-d '{
"projectgoal": {
"display_name": "Engaged Reader",
"goal_type": 8,
"goal_url": "https://example-blog.com/articles/performance-optimization",
"include_urls": [],
"exclude_urls": [],
"url": [{"match_type": 1}],
"time_threshold": 30,
"project_linkname": "website-performance-project"
}
}Successful response
HTTP 200 (or 201 depending on server; confirm with backend :
Response field mapping
status_code — internal API code string. 10000 indicates success in this payload.
status_string — human-readable status message.
projectgoals — array of created/processed goal objectsgoal_id / goal_id_string — canonical ID for the new goal (store this; used by other APIs).
display_name — echoed back.
goal_type — Type of goal (see Goal Types in Pre-requisites).
time_threshold — if applicable.
is_data_tracked — whether tracking is active now.
goal_status — numeric status flag (e.g., active/inactive). Define values elsewhere.
created_time / created_date — timestamps; created_time in ms.
unique_goal_achieved_count / unique_visitor_count — initialized counters.
Notes & Best Practices
The endpoint expects both path linkname and projectgoal.project_linkname. If they mismatch, the request should be rejected — consistency check. (Don't rely solely on path params.)
If include_urls and exclude_urls are both empty, the goal applies to the entire project by default.
Sample Response
Copied{
"status_code": "10000",
"status_string": "All resource were processed successfully.",
"timeTakenToProcessTheRequest": "97 ms",
"projectgoals": [
{
"created_time": 1761732418306,
"time_spent_seconds": "0s",
"goal_type": 8,
"unique_visitor_count": 0,
"time_threshold": 1,
"display_name": "Time spent",
"goal_id_string": "93969000000011017",
"time_spent": 0,
"goal_id": 93969000000011017,
"project_id": 93969000000007437,
"project_linkname": "my-project",
"success": true,
"goal_status": 1,
"is_data_tracked": false,
"created_date": "Oct 29, 2025",
"linkname": "time-spent",
"unique_goal_achieved_count": 0
}],
"count": 1
}