From fd35a2fdc7281a07c723316b6f1651b9a52a50a8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 27 Jun 2026 13:50:39 +0000 Subject: [PATCH 1/3] Add public track(_:params:) analytics alias Adds a thin, fire-and-forget convenience alias that delegates to register(placement:params:handler:) with handler nil. Lets developers send arbitrary analytics events that are queryable via the Query API, without paywall presentation handling or feature gating. Includes Objective-C overloads mirroring the existing register convenience methods. --- .../Presentation/PublicPresentation.swift | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift b/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift index 4bc5d51c1b..0a705958de 100644 --- a/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift +++ b/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift @@ -245,6 +245,45 @@ extension Superwall { internallyRegister(placement: placement, params: params) } + // MARK: - Track + + /// Registers an analytics event with Superwall, with no paywall presentation handling and no feature gating. + /// + /// This is a thin, fire-and-forget convenience alias for ``register(placement:params:handler:)`` with `handler` set to `nil`. Use it to send arbitrary analytics events, which are sent to Superwall and queryable via the Query API. + /// + /// - Parameters: + /// - event: The name of the analytics event you wish to track. + /// - params: Optional parameters you'd like to pass with your event. These can be referenced within the audience filters of your campaign. Keys beginning with `$` are reserved for Superwall and will be dropped. Values can be any JSON encodable value, URLs or Dates. Arrays and dictionaries as values are not supported at this time, and will be dropped. Defaults to `nil`. + public func track(_ event: String, params: [String: Any]? = nil) { + register(placement: event, params: params, handler: nil) + } + + /// Objective-C-only convenience method. Registers an analytics event with Superwall, with no paywall presentation handling and no feature gating. + /// + /// This is a thin, fire-and-forget convenience alias for ``register(placement:params:handler:)`` with `handler` set to `nil`. Use it to send arbitrary analytics events, which are sent to Superwall and queryable via the Query API. + /// + /// - Parameters: + /// - event: The name of the analytics event you wish to track. + @available(swift, obsoleted: 1.0) + @objc public func track(_ event: String) { + register(placement: event) + } + + /// Objective-C-only convenience method. Registers an analytics event with Superwall, with no paywall presentation handling and no feature gating. + /// + /// This is a thin, fire-and-forget convenience alias for ``register(placement:params:handler:)`` with `handler` set to `nil`. Use it to send arbitrary analytics events, which are sent to Superwall and queryable via the Query API. + /// + /// - Parameters: + /// - event: The name of the analytics event you wish to track. + /// - params: Optional parameters you'd like to pass with your event. These can be referenced within the audience filters of your campaign. Keys beginning with `$` are reserved for Superwall and will be dropped. Values can be any JSON encodable value, URLs or Dates. Arrays and dictionaries as values are not supported at this time, and will be dropped. Defaults to `nil`. + @available(swift, obsoleted: 1.0) + @objc public func track( + _ event: String, + params: [String: Any]? + ) { + register(placement: event, params: params) + } + private func trackAndPresentPaywall( forPlacement placement: String, params: [String: Any]? = nil, From 45266179ebe4aedaef7c3d3294117b17fe7fd493 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 27 Jun 2026 13:56:56 +0000 Subject: [PATCH 2/3] Fix ObjC selector clash on track overloads Give the @objc track convenience overloads explicit selectors (trackEvent:, trackEvent:params:) so they no longer collide with the track: selector exported by the unavailable track tombstone in SuperwallGraveyard. --- .../Paywall/Presentation/PublicPresentation.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift b/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift index 0a705958de..320ceb9108 100644 --- a/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift +++ b/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift @@ -265,7 +265,7 @@ extension Superwall { /// - Parameters: /// - event: The name of the analytics event you wish to track. @available(swift, obsoleted: 1.0) - @objc public func track(_ event: String) { + @objc(trackEvent:) public func track(_ event: String) { register(placement: event) } @@ -277,7 +277,7 @@ extension Superwall { /// - event: The name of the analytics event you wish to track. /// - params: Optional parameters you'd like to pass with your event. These can be referenced within the audience filters of your campaign. Keys beginning with `$` are reserved for Superwall and will be dropped. Values can be any JSON encodable value, URLs or Dates. Arrays and dictionaries as values are not supported at this time, and will be dropped. Defaults to `nil`. @available(swift, obsoleted: 1.0) - @objc public func track( + @objc(trackEvent:params:) public func track( _ event: String, params: [String: Any]? ) { From 1e6cd926bcfd31b8c15362e9932f7a50d9a73ca6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 27 Jun 2026 14:05:19 +0000 Subject: [PATCH 3/3] Fix invalid redeclaration of track(_:params:) The @objc track convenience overloads shared the Swift signature track(_:params:) with the active Swift track(_:params:) alias. @available(swift, obsoleted: 1.0) does not exempt a declaration from Swift's redeclaration check (only @available(*, unavailable) does), so the module failed to compile (run-tests and build-maccatalyst, exit 65). Give the ObjC-only overloads a labeled 'event:' parameter so their Swift signatures (track(event:), track(event:params:)) are distinct from the Swift track(_:params:), mirroring the existing register(placement:) ObjC convenience pattern. The explicit trackEvent:/trackEvent:params: ObjC selectors are unchanged, so the Objective-C API is preserved. --- .../Paywall/Presentation/PublicPresentation.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift b/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift index 320ceb9108..aa790f6b48 100644 --- a/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift +++ b/Sources/SuperwallKit/Paywall/Presentation/PublicPresentation.swift @@ -265,7 +265,7 @@ extension Superwall { /// - Parameters: /// - event: The name of the analytics event you wish to track. @available(swift, obsoleted: 1.0) - @objc(trackEvent:) public func track(_ event: String) { + @objc(trackEvent:) public func track(event: String) { register(placement: event) } @@ -278,7 +278,7 @@ extension Superwall { /// - params: Optional parameters you'd like to pass with your event. These can be referenced within the audience filters of your campaign. Keys beginning with `$` are reserved for Superwall and will be dropped. Values can be any JSON encodable value, URLs or Dates. Arrays and dictionaries as values are not supported at this time, and will be dropped. Defaults to `nil`. @available(swift, obsoleted: 1.0) @objc(trackEvent:params:) public func track( - _ event: String, + event: String, params: [String: Any]? ) { register(placement: event, params: params)