Sending Custom Events
Learn how to send custom events to Hardal for server-side measurement from your website or application
Sending custom events with Hardal Hardal Web SDK provides a flexible way to track custom events through the hardal.track()
method.
This guide will show you how to implement custom event tracking for different use cases.
Sending Events
Basic Event Tracking
The simplest form of tracking is sending just an event name:
You can run this event both client and server-side
Events with Properties
You can send additional data with your events using the properties parameter:
You can run this event both client and server-side
E-commerce Marketing Event Examples:
For e-commerce websites, you can track detailed purchase information:
Gaming Events Examples:
For gaming applications, track player progress and interactions:
Server-Side Processing
When these events are sent to Hardal, they are automatically enriched with additional information as shown in the data schema:
Server-generated distinct ID
Unique cookieless identifier generated for each session.
You can enable or disable the SDK from generating identifiers to ensure better compliance with marketing and analytics regulations, such as GDPR, KVKK, or other privacy standards.
Page Information
Details about the current page.
-
Path: /products
-
Title: Product Catalog
You can enable or disable from SDK. with autoPageView: True // False
Screen and browser details
Device and browser specifications
-
Resolution: 1920x1080
-
Browser: Chrome
-
Version: 131.0.0.0
Device type
Type of device being used (e.g., desktop, mobile, tablet)
Timezone
User’s timezone
Example: Europe/Istanbul
Timestamp
Server event occurrence time
2024-12-19T09:45:39.659Z
Query parameters
Any URL query parameters, including UTMs.
You can include as many custom parameters as needed to custom your marketing and analytics goals, as long as they don’t conflict with reserved keywords like standard UTM parameters.
Best Practices
-
Consistent Naming: Use snake_case for event names and properties
-
Structured Data: Group related properties into nested objects
-
Data Types: Use appropriate data types (strings, numbers, booleans, arrays)
-
Timestamp Handling: Include timestamps for time-sensitive events
-
Validation: Verify all required properties are present before sending
Was this page helpful?