Skip to content

Commit

Permalink
feat(analytics): add execute auctions funcitions to analytics sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
smargozzini committed Jul 25, 2024
1 parent 20bdb70 commit 7e04f79
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Sources/Topsort-Analytics/Analytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ public class Analytics {
@FilePersistedValue(storePath: PathHelper.path(for: "com.topsort.analytics.opaque-user-id.plist"))
private var _opaqueUserId: String?
public var opaqueUserId: String {
get {
get {
if let oui = _opaqueUserId {
return oui
} else {
let oui = Self.newOpaqueUserId()
_opaqueUserId = oui
return oui
}
}
}
}
private init() {}
public func set(opaqueUserId: String?) {
self._opaqueUserId = opaqueUserId ?? Self.newOpaqueUserId()
}
public func configure(apiKey: String, url: String?) {
public func configure(apiKey: String, url: String? = nil) {
EventManager.shared.configure(apiKey: apiKey, url: url)
AuctionManager.shared.configure(apiKey: apiKey, url: url)
}
public func track(impression event: Event) {
EventManager.shared.push(event: .impression(event))
Expand All @@ -32,4 +33,8 @@ public class Analytics {
EventManager.shared.push(event: .purchase(event))
}
private static func newOpaqueUserId() -> String { UUID().uuidString }

public func executeAuctions(auctions: [Auction]) async -> AuctionResponse? {
return await AuctionManager.shared.executeAuctions(auctions: auctions)
}
}

0 comments on commit 7e04f79

Please sign in to comment.