Skip to content

Include att param in request#268

Closed
kiftio wants to merge 2 commits into
mainfrom
att-param
Closed

Include att param in request#268
kiftio wants to merge 2 commits into
mainfrom
att-param

Conversation

@kiftio

@kiftio kiftio commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

Appends the App Tracking Transparency (ATT) authorization status as a _att query parameter to the checkout URL when presenting the checkout experience. This allows the checkout to be aware of the user's tracking consent status on iOS 14+.

The ATT status is mapped to one of the following string values: authorized, denied, not_determined, restricted, unknown, or not_applicable (when ATT is unavailable on the platform). If a _att query parameter already exists on the URL, it is replaced to ensure only a single value is present. The implementation conditionally imports AppTrackingTransparency so it remains compatible with environments where the framework is unavailable.

How to test

  1. Run the existing test suite to verify the new CheckoutURLTests cases pass, including:
    • ATT status is appended as _att to a clean URL
    • Existing query parameters are preserved alongside _att
    • An existing _att parameter is replaced rather than duplicated
    • Appending the status multiple times is idempotent
  2. Build and run the sample app on a physical device or simulator running iOS 14+. Trigger the checkout flow and inspect the URL passed to the web view to confirm the _att parameter reflects the device's current ATT authorization status.
  3. Verify the build succeeds on targets where AppTrackingTransparency is not available (e.g., macOS or older iOS targets) and that not_applicable is used in those cases.

Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated platforms/swift/CHANGELOG.md
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Android version?
  • I have bumped the versionName in platforms/android/lib/build.gradle
  • I have updated platforms/android/CHANGELOG.md
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 92%
91.59% (316/345) 87.25% (178/204) 100% (82/82)

@kiftio kiftio marked this pull request as ready for review June 9, 2026 22:18
@kiftio kiftio requested a review from a team as a code owner June 9, 2026 22:18
@kiftio kiftio requested a review from alejandro-shopify June 10, 2026 08:38
Comment on lines +76 to +88
fileprivate var checkoutQueryValue: String {
switch self {
case .authorized:
return "authorized"
case .denied:
return "denied"
case .notDetermined:
return "not_determined"
case .restricted:
return "restricted"
@unknown default:
return "unknown"
}

@alejandro-shopify alejandro-shopify Jun 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very verbose, and will inflate the checkout URL. Just _att=a/d/n/r/u should be enough.

@@ -1,3 +1,6 @@
#if canImport(AppTrackingTransparency)

@kieran-osgood-shopify kieran-osgood-shopify Jun 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whilst we wait on approval it'd be good to confirm if we can drop iOS 13 (and maybe 14) depending on usage data, and it'll remove the can import stuff)

I scanned the last 7 days of traffic and saw nothing below 18 showup

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

enum CheckoutAppTrackingTransparency {
static let queryParameterName = "_att"
static let notApplicableStatus = "not_applicable"
static var currentStatus: () -> String = defaultCurrentStatus

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to keep track of a mutable value of the current status, and do we need to maintain a defaultCurrentStatus?

Seems like we should just be able to create a method that always accesses ATTTrackingManager.trackingAuthorizationStatus and maps it to the checkoutQueryValue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it ugly, all for tests really. Is there a better mocking approach in swift?

@kiftio kiftio closed this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants