Evntaly
Visit Evntaly
  • 💙Welcome to Evntaly
  • What is Evntaly ?
  • Why Evntaly ?
  • Getting Started
  • 📦Supported Langauges
    • JavaScript
    • Ruby
    • Python
    • C#
    • Go
    • PHP
    • Web
    • cURL
      • Swift – Native HTTP
      • Flutter - Dart
      • Android - Kotlin
Powered by GitBook
On this page
  • Installation
  • Initialization
  • Tracking Events
  • User Identification
  • Enabling and Disabling Tracking
  • Methods
  • Best Practices
  • Troubleshooting
  • Support
  1. Supported Langauges

Go

Go Lang SDK

PreviousC#NextPHP

Last updated 3 months ago

The Evntaly Go SDK provides an efficient and robust way to integrate event tracking, user identification, and analytics into your Go applications.

Installation

Install the Evntaly Go SDK using the Go package manager:

 go get github.com/Evntaly/evntaly-go

Initialization

package main

import (
    "github.com/Evntaly/evntaly-go"
    "fmt"
)

func main() {
    evntaly := evntaly.NewEvntalySDK("YOUR_DEVELOPER_SECRET", "YOUR_PROJECT_TOKEN")
    fmt.Println("Evntaly SDK initialized!")
}

Tracking Events

For custom event tracking, use the Track method.

 event := evntaly.Event{
     Title:       "Payment Received",
     Description: "User completed a purchase",
     Message:     "Order #12345",
     Data: map[string]interface{}{
         "user_id": "67890",
         "timestamp": "2025-01-08T09:30:00Z",
         "referrer": "social_media",
         "email_verified": true,
         "amount": 149.99,
         "currency": "USD",
         "payment_method": "Credit Card",
     },
     Tags:       []string{"purchase", "payment", "ecommerce"},
     Notify:     true,
     Icon:       "💰",
     ApplyRuleOnly: false,
     User:       evntaly.User{ID: "12345"},
     Type:       "Transaction",
     SessionID:  "20750ebc-dabf-4fd4-9498-443bf30d6095_bsd",
     Feature:    "Checkout",
     Topic:      "@Sales",
 }
 err := evntaly.Track(event)
 if err != nil {
     fmt.Println("Error tracking event:", err)
 }

User Identification

Identify a user to associate events with a specific profile.

 user := evntaly.User{
     ID:           "12345",
     Email:        "user@example.com",
     FullName:     "John Doe",
     Organization: "ExampleCorp",
     Data: map[string]interface{}{
         "id": "JohnD",
         "email": "user@example.com",
         "location": "USA",
         "salary": 75000,
         "timezone": "America/New_York",
         "subscription_plan": "Premium",
         "last_login": "2025-02-24T15:30:00Z",
     },
 }
 err := evntaly.IdentifyUser(user)
 if err != nil {
     fmt.Println("Error identifying user:", err)
 }

Enabling and Disabling Tracking

You can enable or disable event tracking globally.

 evntaly.DisableTracking()  // Disables tracking
 evntaly.EnableTracking()   // Enables tracking

Methods

Method
Description
Example Usage
Available Since

NewEvntalySDK

Initializes the SDK with API credentials.

evntaly.NewEvntalySDK(token, projectName)

v1.0.0

Track

Tracks a custom event.

evntaly.Track(event)

v1.0.0

IdentifyUser

Identifies a user for analytics.

evntaly.IdentifyUser(user)

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.

Initialize the SDK with your Developer Secret and Project Token - Check

📦
Here
GitHub - Evntaly/evntaly-go: Evntaly official library for your Python projectsGitHub
Logo