Go SDK
Track your data via the Go SDK for Vemetric.
Below you can see how to initialize and configure the SDK, as well as all the available functions.
The Go SDK doesn’t track your page visitors and is meant as a complement to the Frontend SDKs.
Installation
Install the SDK
In your project directory, run:
Initialize the Vemetric Client
We recommend creating a single instance of the Vemetric client and reusing it throughout your application.
Replace
YOUR_PROJECT_TOKEN
with the unique token for your project (found in the project settings).
If you’re using a proxy to track data via your own domain, you can pass the
host
option to the client with e.g.https://hub.yourdomain.com
.
Methods
Below you can find all the available methods and their functionality.
trackEvent
The main method to track any kind of event.
You need to pass an vemetric.TrackEventOpts
object with the following properties:
EventName
: Required: The name of the event to track.UserIdentifier
: Required: The identifier of the user to associate the event with.EventData
: Optional: An object containing the meta data of the event so you can later filter byUserData
: Optional: An object to update the user data.Set
: An object containing the user data to set, overriding existing values.SetOnce
: An object containing the user data to set once, only if the keys do not exist yet.Unset
: An array of keys to remove from the user data.
Checkout the tracking custom events section to learn more.
updateUser
Updates the data of the user with the given identifier.
You need to pass an vemetric.UpdateUserOpts
object with the following properties:
UserIdentifier
: Required: The identifier of the user to associate the event with.UserData
: An object to update the user data.Set
: An object containing the user data to set, overriding existing values.SetOnce
: An object containing the user data to set once, only if the keys do not exist yet.Unset
: An array of keys to remove from the user data.
Resources
View the Package of the Go SDK.
View the source code of the Go SDK on GitHub.
Track your data via the Python SDK for Vemetric.