All URIs are relative to https://api.sendx.io/api/v1/rest
| Method | HTTP request | Description |
|---|---|---|
| track_custom_event | POST /events/custom | Track custom event |
| track_revenue_event | POST /events/revenue | Track revenue event |
track_custom_event(custom_event_request)
Track custom event
Records custom events for advanced tracking.
require 'time'
require 'sendx-ruby-sdk'
# setup authorization
SendX.configure do |config|
# Configure API key authorization: TeamApiKey
config.api_key['X-Team-ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-Team-ApiKey'] = 'Bearer'
end
api_instance = SendX::EventsApi.new
custom_event_request = SendX::CustomEventRequest.new({name: 'video_watched'}) # CustomEventRequest |
begin
# Track custom event
result = api_instance.track_custom_event(custom_event_request)
p result
rescue SendX::ApiError => e
puts "Error when calling EventsApi->track_custom_event: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> track_custom_event_with_http_info(custom_event_request)
begin
# Track custom event
data, status_code, headers = api_instance.track_custom_event_with_http_info(custom_event_request)
p status_code # => 2xx
p headers # => { ... }
p data # => <EventResponse>
rescue SendX::ApiError => e
puts "Error when calling EventsApi->track_custom_event_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| custom_event_request | CustomEventRequest |
- Content-Type: application/json
- Accept: application/json
track_revenue_event(revenue_event_request)
Track revenue event
Records revenue events for analytics and attribution.
require 'time'
require 'sendx-ruby-sdk'
# setup authorization
SendX.configure do |config|
# Configure API key authorization: TeamApiKey
config.api_key['X-Team-ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-Team-ApiKey'] = 'Bearer'
end
api_instance = SendX::EventsApi.new
revenue_event_request = SendX::RevenueEventRequest.new({identifier: 'customer@example.com', amount: 99.99}) # RevenueEventRequest |
begin
# Track revenue event
result = api_instance.track_revenue_event(revenue_event_request)
p result
rescue SendX::ApiError => e
puts "Error when calling EventsApi->track_revenue_event: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> track_revenue_event_with_http_info(revenue_event_request)
begin
# Track revenue event
data, status_code, headers = api_instance.track_revenue_event_with_http_info(revenue_event_request)
p status_code # => 2xx
p headers # => { ... }
p data # => <EventResponse>
rescue SendX::ApiError => e
puts "Error when calling EventsApi->track_revenue_event_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| revenue_event_request | RevenueEventRequest |
- Content-Type: application/json
- Accept: application/json