Skip to content

fix: [SDK-5701] treat indirect attribution window as minutes - #1801

Merged
fadi-george merged 3 commits into
mainfrom
fadi/sdk-5701
Nov 10, 2026
Merged

fadi-george merged 3 commits into
mainfrom
fadi/sdk-5701

Conversation

@fadi-george

@fadi-george fadi-george commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Convert the indirect attribution window from minutes to seconds before comparing it against notification and IAM ages.

Details

Motivation

minutes_since_displayed from remote params, and DEFAULT_INDIRECT_ATTRIBUTION_WINDOW (24 * 60), are in minutes. OSChannelTracker lastReceivedIds compared that value against an elapsed time in seconds. A 60 minute window only covered 60 seconds, and the default 24 hour window only covered about 24 minutes. App opens shortly after a push came in were then UNATTRIBUTED instead of INDIRECT. Android already does this conversion (ChannelTracker.kt, indirectAttributionWindow * 60 * 1000L).

Fixes SDK-5701. Same symptom as SDK-4619.

Scope

  • One line in OSChannelTracker. The notification and IAM trackers both inherit it, so both channels are fixed.
  • Stored values and remote params parsing are unchanged (still minutes).
  • Expected effect: more sessions are credited as INDIRECT instead of UNATTRIBUTED, matching the dashboard attribution window.

Testing

Unit testing

Added ChannelTrackerAttributionWindowTests with a 60 minute window:

  • A notification from 5 minutes ago is indirect.
  • Of notifications from 61 and 59 minutes ago, only the 59 minute one is kept.
  • A notification exactly 60 minutes old is still indirect.
  • An IAM from 5 minutes ago is indirect.

All four fail without the fix. +[NSDate date] is swizzled by NSDateOverrider in the UnitTests bundle, so the tests set that clock explicitly (added to the bridging header). Full UnitTestApp_TestPlan_Reduced passes locally (667 tests).

Manual testing

Side by side on two iOS simulators running the demo app (examples/demo) against app 0acec4d1-... with a 60 minute influenced window (minutes_since_displayed: 60). One sim was built from main, the other from this branch. Both apps were killed, received the same push without tapping it, and were opened from the icon about 21 minutes later, then backgrounded.

main this PR
SDK session influence UNATTRIBUTED INDIRECT
os__session_duration request direct: false, no notification_ids direct: false, notification_ids: [<push id>]

On main the 21 minute old push fell outside the effective 60 second window. With the fix it is inside the 60 minute window.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

🤖 Generated with Claude Code

@fadi-george
fadi-george requested a review from nan-li November 9, 2026 18:50

@abdulraqeeb33 abdulraqeeb33 left a comment

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.

The window is stored in minutes and this is the only place it is compared. Notification and IAM both use it, and the tests fail if the conversion is removed.

One nit inline.

fadi-george and others added 3 commits November 10, 2026 12:09
The outcomes attribution window from remote params is in minutes, but
lastReceivedIds compared it against a difference in seconds, so the
default 24 hour window only covered about 24 minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fadi-george
fadi-george merged commit dadf371 into main Nov 10, 2026
6 checks passed
@fadi-george
fadi-george deleted the fadi/sdk-5701 branch November 10, 2026 20:32
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