Skip to content

Commit

Permalink
add usage example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ad committed Feb 23, 2024
1 parent 4a8c261 commit 5e307b4
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# package for sending events to Google Analytics 4 using the Measurement Protocol
# ga4

## package for sending events to Google Analytics 4 using the Measurement Protocol

Measurement Protocol (Google Analytics 4) docs reference: https://developers.google.com/analytics/devguides/collection/protocol/ga4

debugging tools: https://ga-dev-tools.google/ga4/event-builder/
Debugging tools: https://ga-dev-tools.google/ga4/event-builder/

### Usage

```go
package main

import (
"fmt"
"github.com/ad/ga4"
)

func main() {
client := ga4.NewGA4Client("G-XXXXXXXXXX", "xxxxxxxxxxxxxxxxxxxxx", "", true)
err := client.SendEvent(
ga4.Event{
Name: "test_event",
Params: map[string]string{
"param1": "value1",
"param2": "value2",
},
},
)
if err != nil {
fmt.Println(err)
}
}
```


0 comments on commit 5e307b4

Please sign in to comment.