Skip to content

Commit

Permalink
✨ Add app_id to activity requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaatttt committed Feb 8, 2024
1 parent 45e533d commit 851813c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/AppcuesKit/Data/Analytics/AnalyticsTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ extension Activity {
case let .event(name, _):
self.init(
accountID: config.accountID,
appID: config.applicationID,
sessionID: sessionID.appcuesFormatted,
userID: storage.userID,
events: [Event(name: name, attributes: update.properties, context: update.context, logger: config.logger)],
Expand All @@ -235,6 +236,7 @@ extension Activity {
case let .screen(title):
self.init(
accountID: config.accountID,
appID: config.applicationID,
sessionID: sessionID.appcuesFormatted,
userID: storage.userID,
events: [Event(screen: title, attributes: update.properties, context: update.context, logger: config.logger)],
Expand All @@ -246,6 +248,7 @@ extension Activity {
case .profile:
self.init(
accountID: config.accountID,
appID: config.applicationID,
sessionID: sessionID.appcuesFormatted,
userID: storage.userID,
events: nil,
Expand All @@ -257,6 +260,7 @@ extension Activity {
case .group:
self.init(
accountID: config.accountID,
appID: config.applicationID,
sessionID: sessionID.appcuesFormatted,
userID: storage.userID,
events: nil,
Expand Down
5 changes: 5 additions & 0 deletions Sources/AppcuesKit/Data/Models/Activity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ internal struct Activity {
var profileUpdate: [String: Any]?
let userID: String
let accountID: String
let appID: String
var groupID: String?
var groupUpdate: [String: Any]?
let userSignature: String?
let sessionID: String

internal init(
accountID: String,
appID: String,
sessionID: String,
userID: String,
events: [Event]?,
Expand All @@ -35,6 +37,7 @@ internal struct Activity {
logger: Logging = OSLog.disabled
) {
self.accountID = accountID
self.appID = appID
self.sessionID = sessionID
self.userID = userID
self.events = events
Expand All @@ -54,6 +57,7 @@ extension Activity: Encodable {
case profileUpdate = "profile_update"
case userID = "user_id"
case accountID = "account_id"
case appID = "app_id"
case sessionID = "session_id"
case groupID = "group_id"
case groupUpdate = "group_update"
Expand All @@ -64,6 +68,7 @@ extension Activity: Encodable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode("mobile", forKey: .source)
try container.encode(accountID, forKey: .accountID)
try container.encode(appID, forKey: .appID)
try container.encode(sessionID, forKey: .sessionID)
try container.encode(userID, forKey: .userID)
try container.encode(groupID, forKey: .groupID)
Expand Down

0 comments on commit 851813c

Please sign in to comment.