C#
Dotnet SDK
The Evntaly C# SDK offers a robust and flexible solution to integrate event tracking, user identification, and analytics into your .NET applications.
Installation
Install the Evntaly C# SDK using NuGet Package Manager:
dotnet add package EvntalySDK
Initialization
Initialize the SDK with your Developer Secret and Project Token - Chech Here
using System;
using EvntalySDK;
class Program
{
static void Main()
{
var evntaly = new SDK("YOUR_DEVELOPER_SECRET", "YOUR_PROJECT_TOKEN");
Console.WriteLine("Evntaly SDK initialized!");
}
}
Tracking Events
For custom event tracking, use the Track method.
var eventData = new Event
{
Title = "Payment Received",
Description = "User completed a purchase",
Message = "Order #12345",
Data = new EventData
{
UserId = "67890",
Timestamp = "2025-01-08T09:30:00Z",
Referrer = "social_media",
EmailVerified = true,
},
Tags = new string[] {"purchase", "payment", "ecommerce"},
Notify = true,
Icon = "💰",
ApplyRuleOnly = false,
User = new EventUser { ID = "12345" },
Type = "Transaction",
SessionID = "20750ebc-dabf-4fd4-9498-443bf30d6095_bsd",
Feature = "Checkout",
Topic = "@Sales"
};
await evntaly.TrackEventAsync(eventData);
User Identification
Identify a user to associate events with a specific profile.
var userData = new UserProfile
{
ID = "12345",
Email = "user@example.com",
FullName = "John Doe",
Organization = "ExampleCorp",
Data = new UserProfileData
{
Id = "JohnD",
Email = "user@example.com",
Location = "USA",
Salary = 75000,
Timezone = "America/New_York",
SubscriptionPlan = "Premium",
LastLogin = "2025-02-24T15:30:00Z"
}
};
await evntaly.IdentifyUserAsync(userData);
Enabling and Disabling Tracking
You can enable or disable event tracking globally.
// Disable tracking
evntaly.DisableTracking();
// Enable tracking
evntaly.EnableTracking();
Methods
Track
Tracks a custom event.
evntaly.Track(new Event { Title = "Event" })
v1.0.0
IdentifyUser
Identifies a user for analytics.
evntaly.IdentifyUser(new User { ID = "user-123" })
v1.0.0
DisableTracking
Disables all event tracking.
evntaly.DisableTracking()
v1.0.0
EnableTracking
Enables all event tracking.
evntaly.EnableTracking()
v1.0.0
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.
Last updated