Skip to content

zunda-pixel/googleanalytics-swift

Repository files navigation

GoogleAnalytics Measurement Protocol for Swift

GA4 Measurement Protocol

let client = GoogleAnalytics(
  httpClient: .urlSession(.shared),
  apiSecret: "bCab-SdfDBi2L3ZPaYHYfw",
  id: .firebase(
    firebaseAppId: "1:211175559289:ios:121555f3c816aecc3cd5d8",
    appInstanceId: UUID().uuidString.replacingOccurrences(of: "-", with: "")
  )
)

let sessionId = UUID().uuidString.replacingOccurrences(of: "-", with: "")

try await client.send(for: .login(
  method: "Email",
  sessionId: sessionId,
  engagementTime: 123
))

About

Google Analytics Measurement Protocol REST API Client for Swift

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages