🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

github.com/ystyle/google-analytics

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ystyle/google-analytics

v0.0.0-20210425064301-a7f754dd0649
Source
Go
Version published
Created
Source

google-analytics

Implement Measurement Protocol (Google Analytics 4)

USAGE

package main

import (
	"fmt"
	"math/rand"
	"time"
	"github.com/ystyle/google-analytics"
)

func main() {
	analytics.SetKeys("goxxxxx-xxxxxxxxxxx", "G-xxxxxxx") // // required
	tt := time.Now().Unix()
	payload := analytics.Payload{
		ClientID: fmt.Sprintf("%d.%d", rand.Int31(), tt), // required
		Events: []analytics.Event{
			{
				Name: "tutorial_begin", // required
				Params: map[string]interface{}{
					
                },
			},
		},
	}
	// analytics.Debug(true)
	analytics.Send(payload)
}

FAQs

Package last updated on 25 Apr 2021

Did you know?

Socket

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.

Install

Related posts