Ruby
Ruby SDK
Ruby client for interacting with the Evntaly event tracking platform. provides developers with a straightforward interface to initialize the SDK, track events, identify users, manage tracking states.
Installation
To install the SDK using bundler
:
gem 'evntaly', '~> 1.0'
and then run:
bundle install
or install directly using:
gem install evntaly
Initialization
Initialize the SDK with your developer secret and project token:
sdk = Evntaly::SDK.new(
developer_secret: 'YOUR_DEVELOPER_SECRET',
project_token: 'YOUR_PROJECT_TOKEN'
)
Tracking Events
To track an event, use the track
method with an associative array containing the event details.
event = Evntaly::Event.new(
title: 'User Signed Up',
description: 'A new user signed up to the platform.',
message: 'Welcome email sent to the user.',
data: { plan: 'pro', referrer: 'campaign_xyz' },
tags: ['signup', 'email', 'marketing'],
notify: true,
icon: "💰",
apply_rule_only: false,
user: { id: '12345' },
type: 'user_event',
session_id: 'session_abc',
feature: 'onboarding',
topic: 'user_activity'
)
begin
sdk.track(event)
rescue => e
# error handling logic
end
Identifying Users
To identify user details, use the identifyUser
method. This helps link events to specific users and enriches your analytics.
user = Evntaly::User.new(
id: 'u123',
email: 'user@example.com',
full_name: 'John Doe',
organization: 'Example Org',
data: { role: 'admin' }
)
begin
sdk.identify_user(user)
rescue => e
# error handling logic
end
Enabling and Disabling Tracking
You can globally enable or disable event tracking for the current SDK instance. This might be useful for development/testing or respecting user consent.
Evntaly::SDK.disable_tracking # Disables tracking
Evntaly::SDK.enable_tracking # Enables tracking
Best Practices
Initialize early: Always initialize the SDK as early as possible.
Avoid sensitive data: Do not pass sensitive personal data directly to the SDK.
Monitor API limits: Regularly check API limits to avoid missing critical events.
Troubleshooting
Events not appearing: Check if the SDK is initialized correctly and the API tokens are valid.
Network errors: Ensure your network allows requests to
https://evntaly.com
.
Support
For additional help, contact support at support@evntaly.com.
✨ Open-source community Achievements
Huge shout-out and thank you for the legendary Sayed El-Essawy who developed this SDK and it has been added, reviewed and tested by the Evntaly team.
Last updated