desertjinn / freshsales

a Go SDK for the https://www.freshsales.io platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

freshsales

a GoLang SDK to help track events for the https://www.freshsales.io CRM platform

How ?

import the library in your go file

package freshsales

import "github.com/desertjinn/freshsales"

initialise to start tracking customer events

package yourpackage

import "github.com/desertjinn/freshsales"
...
...
    ...
    ...

    analytics := &Analytics{
        Domain: <your Freshsales domain host. eg: yourcompany.freshsales.io>, 
        Token: <your Freshsales API token>
    }

identify a New Customer

    ...
    ...
    
    identifier := "a unique identifier for your customer"
    properties : map[string]interface{}{
        "key": "value", 
        "the customer": "properties",
    }   
    err := analytics.Identify(identifier, properties)
    if err != nil {
        fmt.Println(err)
    }

track an Event

    ...
    ...
    
    identifier := "your customer's unique identifier"
    properties : map[string]interface{}{
        "key": "value", 
        "the event": "properties",
    }   
    err := analytics.TrackEvent(identifier, properties)
    if err != nil {
        fmt.Println(err)
    }

track a Page View

    ...
    ...
    
    identifier := "your customer's unique identifier"
    url := "the page viewed"
    err := analytics.TrackPageView(identifier, url)
    if err != nil {
        fmt.Println(err)
    }

About

a Go SDK for the https://www.freshsales.io platform

License:MIT License


Languages

Language:Go 100.0%