Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(analytics): adding in a way to get mac analytics #930

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion PocketKit/Sources/Analytics/Entities/APIUserEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ public struct APIUserEntity: Entity {
public init(consumerKey: String) {
let components = consumerKey.components(separatedBy: "-")
let id: UInt
if let identifier = components.first, let apiID = UInt(identifier) {
if ProcessInfo.processInfo.isiOSAppOnMac {
// Hack to attribute analytics to our Mac Version of Pocket.
// In the future we need to do something more with ouir app id.
id = 8775
} else if let identifier = components.first, let apiID = UInt(identifier) {
id = apiID
} else {
id = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public class PocketSnowplowTracker: SnowplowTracker {
.scale
]

if ProcessInfo.processInfo.isiOSAppOnMac {
trackerConfiguration.devicePlatform = .desktop
trackerConfiguration.appId = "pocket-mac-next"
}

let optionalTracker = Snowplow.createTracker(
namespace: appID,
network: networkConfiguration,
Expand Down