Skip to content

Track event

POST
/public/event
curl --request POST \
--url https://user.userguiding.com/public/event \
--header 'Content-Type: application/json' \
--header 'UG-API-KEY: <UG-API-KEY>' \
--data '{ "user_id": "example", "name": "example", "metadata": {} }'

Records a custom event for a user, like userGuiding.track() does in the browser. Use it for actions that happen on your server or while the user is offline.

If no user has this ID yet, the user is created. You can use the event in segments and goals like any event from the SDK.

Media typeapplication/json
PublicEventPayload
object
user_id
required
User Id

Your own ID for the user who did the action.

string
<= 1024 characters
name
required
Name

Event name, such as report_exported.

string
<= 1024 characters
metadata
Metadata

Optional details about the event, such as {"format": "csv"}.

object

The user the event was tracked for.

Media typeapplication/json
Any of:
User
object
browser_language
required
Any of:
string
browser_name
required
Any of:
string
browser_version
required
Any of:
string
device_model
required
Any of:
string
device_type
required
Any of:
string
device_vendor
required
Any of:
string
os_name
required
Any of:
string
os_version
required
Any of:
string
account_id
required
Account Id

Your UserGuiding account ID.

string
<= 1024 characters
user_id
required
User Id

Your own ID for the user.

string
<= 1024 characters
project_id
required
Any of:
string
<= 1024 characters
company_id
required
Any of:
string
created
required
Created

When the user was created in UserGuiding.

string format: date-time
first_seen
required
Any of:
string format: date-time
last_seen
required
Any of:
string format: date-time
last_product_updates_interacted
required
Any of:
string format: date-time
last_ai_assistant_interacted
required
Any of:
string format: date-time
is_anonymous
required
Is Anonymous

Whether the user is anonymous, such as a Knowledge Base or Product Updates visitor you never identified.

boolean
web_session
required
Web Session

Number of sessions the user has started in your app.

integer
0
country
required
Any of:
string
survey_score
required
Any of:
integer
survey_feedback
required
Any of:
string
source
required
Any of:
UserSource
string
Allowed values: hubspot_integration segment_integration sdk public_api product_updates knowledge_base webhook salesforce_integration amplitude_integration mixpanel_integration csv_import
attributes
required
Attributes

Custom attributes you sent through the SDK, this API or an integration.

object
ab_test_attributes
required
Any of:
object
preview_start
required
Preview Start

IDs of the guides the user started.

Array<string>
default:
preview_complete
required
Preview Complete

IDs of the guides the user completed.

Array<string>
default:
hotspot_interact
required
Hotspot Interact

IDs of the hotspots the user interacted with.

Array<string>
default:
checklist_url_click
required
Checklist Url Click

IDs of the checklist items whose link the user clicked.

Array<string>
default:
hotspot_dismiss
required
Hotspot Dismiss

IDs of the hotspots the user dismissed.

Array<string>
default:
checklist_complete
required
Checklist Complete

IDs of the checklists the user completed.

Array<string>
default:
preview_dismiss
required
Preview Dismiss

IDs of the guides the user closed before finishing.

Array<string>
default:
checklist_dismiss
required
Checklist Dismiss

IDs of the checklists the user dismissed.

Array<string>
default:
banner_seen
required
Banner Seen

IDs of the banners the user saw.

Array<string>
default:
banner_dismiss
required
Banner Dismiss

IDs of the banners the user dismissed.

Array<string>
default:
group_ids
required
Group Ids

IDs of the user groups the user belongs to.

Array<string>
default:
survey_interaction_times
required
Survey Interaction Times

When the user last saw each survey.

Array<object>
default:
MaterialInteractionTime
object
material_id
required
Material Id

ID of the guide, hotspot, banner or survey.

string
<= 1024 characters
time
required
Time

When it last happened.

string format: date-time
guide_interaction_times
required
Guide Interaction Times

When the user last started each guide.

Array<object>
default:
MaterialInteractionTime
object
material_id
required
Material Id

ID of the guide, hotspot, banner or survey.

string
<= 1024 characters
time
required
Time

When it last happened.

string format: date-time
banner_interaction_times
required
Banner Interaction Times

When the user last saw each banner.

Array<object>
default:
MaterialInteractionTime
object
material_id
required
Material Id

ID of the guide, hotspot, banner or survey.

string
<= 1024 characters
time
required
Time

When it last happened.

string format: date-time
hotspot_interaction_times
required
Hotspot Interaction Times

When the user last interacted with each hotspot.

Array<object>
default:
MaterialInteractionTime
object
material_id
required
Material Id

ID of the guide, hotspot, banner or survey.

string
<= 1024 characters
time
required
Time

When it last happened.

string format: date-time
guide_triggers_count
required
Guide Triggers Count

How many times the user started each guide.

Array<object>
default:
MaterialTriggerCount
object
material_id
required
Material Id

ID of the guide, banner or survey.

string
<= 1024 characters
count
required
Count

How many times it showed to the user.

integer
survey_triggers_count
required
Survey Triggers Count

How many times the user saw each survey.

Array<object>
default:
MaterialTriggerCount
object
material_id
required
Material Id

ID of the guide, banner or survey.

string
<= 1024 characters
count
required
Count

How many times it showed to the user.

integer
banner_triggers_count
required
Banner Triggers Count

How many times the user saw each banner.

Array<object>
default:
MaterialTriggerCount
object
material_id
required
Material Id

ID of the guide, banner or survey.

string
<= 1024 characters
count
required
Count

How many times it showed to the user.

integer
survey_responses
required
Survey Responses

The user’s survey answers, one item per question.

Array<object>
default:
UserSurveyResponse
object
survey_id
required
Survey Id

ID of the survey.

string
<= 1024 characters
question_id
required
Question Id

ID of the question.

string
<= 1024 characters
score
required
Any of:
integer
feedback
required
Any of:
string
choices
required
Any of:
Array<string>
created
required
Created

When the user answered.

string format: date-time
events_summary
required
Events Summary

Count and first and last time of each custom event the user triggered.

Array<object>
default:
EventSummary
object
last_occurred
required
Last Occurred

When the user last triggered the event.

string format: date-time
first_occurred
required
First Occurred

When the user first triggered the event.

string format: date-time
count
required
Count

How many times the user triggered the event.

integer
name
required
Name

Event name.

string
goal_reached_times
required
Goal Reached Times

Goals the user reached, and when.

Array<object>
default:
GoalSummary
object
goal_id
required
Goal Id

ID of the goal.

integer
goal_reached_at
required
Goal Reached At

When the user reached the goal.

string format: date-time
ai_message_limit_exceeded
required
Ai Message Limit Exceeded

Whether your project had reached its AI Assistant message limit when the SDK last identified the user.

boolean
hotspot_button_click
required
Hotspot Button Click

IDs of the hotspot buttons the user clicked.

Array<string>
default:
guide_button_click
required
Guide Button Click

IDs of the guide buttons the user clicked.

Array<string>
default:
banner_button_click
required
Banner Button Click

IDs of the banner buttons the user clicked.

Array<string>
default:
last_knowledge_base_interacted
required
Any of:
string format: date-time
ai_assistant_conversation_started
required
Ai Assistant Conversation Started

Whether the user has started a conversation with the AI Assistant.

boolean
interacted_resource_centers
required
Interacted Resource Centers

IDs of the Resource Centers the user interacted with.

Array<string>
default:
rc_viewed_tabs
required
Rc Viewed Tabs

Resource Center tabs the user opened.

Array<object>
default:
RCTabView
object
tab
required
Tab

The tab the user opened.

string
<= 1024 characters
resource_center_id
required
Resource Center Id

ID of the Resource Center.

string
<= 1024 characters
rc_viewed_rich_contents
required
Rc Viewed Rich Contents

IDs of the Resource Center content items the user opened.

Array<string>
default:
pu_viewed_posts
required
Pu Viewed Posts

IDs of the Product Updates posts the user viewed.

Array<string>
default:
kb_viewed_articles
required
Kb Viewed Articles

IDs of the Knowledge Base articles the user viewed.

Array<string>
default:
voted_feature_requests
required
Voted Feature Requests

IDs of the feature requests the user voted for on your roadmap.

Array<string>
default:
company
required
Any of:
Company
object
company_id
required
Company Id

Your own ID for the company.

string
<= 1024 characters
account_id
required
Account Id

Your UserGuiding account ID.

string
<= 1024 characters
project_id
required
Any of:
string
<= 1024 characters
company_name
required
Any of:
string
<= 1024 characters
company_attributes
required
Company Attributes

Custom attributes of the company.

object
source
required
Any of:
UserSource
string
Allowed values: hubspot_integration segment_integration sdk public_api product_updates knowledge_base webhook salesforce_integration amplitude_integration mixpanel_integration csv_import
created
required
Created

When the company was created in UserGuiding.

string format: date-time
first_seen
required
Any of:
string format: date-time
last_seen
required
Any of:
string format: date-time
company_ab_test_attributes
required
Any of:
object
members_ids
required
Members Ids
Array<string>
default:

Example

{
"is_anonymous": false,
"web_session": 0,
"source": "sdk",
"attributes": {},
"ab_test_attributes": {},
"preview_start": [],
"preview_complete": [],
"hotspot_interact": [],
"checklist_url_click": [],
"hotspot_dismiss": [],
"checklist_complete": [],
"preview_dismiss": [],
"checklist_dismiss": [],
"banner_seen": [],
"banner_dismiss": [],
"group_ids": [],
"survey_interaction_times": [],
"guide_interaction_times": [],
"banner_interaction_times": [],
"hotspot_interaction_times": [],
"guide_triggers_count": [],
"survey_triggers_count": [],
"banner_triggers_count": [],
"survey_responses": [],
"events_summary": [],
"goal_reached_times": [],
"ai_message_limit_exceeded": false,
"hotspot_button_click": [],
"guide_button_click": [],
"banner_button_click": [],
"ai_assistant_conversation_started": false,
"interacted_resource_centers": [],
"rc_viewed_tabs": [],
"rc_viewed_rich_contents": [],
"pu_viewed_posts": [],
"kb_viewed_articles": [],
"voted_feature_requests": [],
"company": {
"company_attributes": {},
"source": "sdk",
"company_ab_test_attributes": {},
"members_ids": []
}
}

The request is invalid. detail lists each problem.

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string

Example generated

{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}

Your project used up its rate limit: bursts of up to 2,000 requests, refilled at 20 requests per second.

Retry-After
integer

Seconds to wait before sending another request.