
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
github.com/areahq/go-heapanalytics
Provides a simple adapter for using the heap analytics API. See the heap documentation for information on the API covered.
There are a number of client options that can be set.
The pattern used here is based on Dave Cheneys blog post
It's nice and clean as nil or blank values do not need to be passed in where default values are needed.
Some predefined options have been setup as listed below.
Allows you to customise the client base url used by the adapter.
Allows you to customise the http client used by the adapter.
Below is example code for using the adapter.
package main
import (
"fmt"
"github.com/AreaHQ/go-heapanalytics"
)
func main() {
// test id used in documentation
appID := "11"
c := heapanalytics.NewClient(appID)
identity := "my@identifier.net"
event := "test_event"
properties := map[string]interface{}{"test_prop": "test_val"}
err := c.Track(identity, event, properties)
if err != nil {
fmt.Printf("Error sending track: %s", err.Error())
} else {
fmt.Println("Event sent.")
}
}
package main
import (
"fmt"
"net/http"
"github.com/AreaHQ/go-heapanalytics"
)
func main() {
// test id used in documentation
appID := "11"
// this may be a custom client that you're reusing
httpClient := http.DefaultClient
c := heapanalytics.NewClient(appID, heapanalytics.HttpClient(httpClient))
identity := "my@identifier.net"
event := "test_event"
properties := map[string]interface{}{"test_prop": "test_val"}
err := c.Track(identity, event, properties)
if err != nil {
fmt.Printf("Error sending track: %s", err.Error())
} else {
fmt.Println("Event sent.")
}
}
package main
import (
"fmt"
"net/http"
"github.com/AreaHQ/go-heapanalytics"
)
func main() {
// test id used in documentation
appID := "11"
// this may be a custom client that you're reusing
httpClient := http.DefaultClient
c := heapanalytics.NewClient(appID, heapanalytics.HttpClient(httpClient))
identity := "my@identifier.net"
properties := map[string]interface{}{"test_prop": "test_val"}
err := c.AddUserProperties(identity, properties)
if err != nil {
fmt.Printf("Error sending track: %s", err.Error())
} else {
fmt.Println("User properties sent.")
}
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.