Skip to content

Commit c9836c1

Browse files
committed
ci: Ensure accurate fresh-install attribution for scenario testing
Resets device identifiers (Android ID) or privacy settings (iOS simulator) when a fresh install is required. This ensures the AppsFlyer server treats the device as truly new, allowing for accurate `is_first_launch` reporting and reliable attribution testing.
1 parent 36ce403 commit c9836c1

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

scripts/af-scenario-runner.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,17 @@ run_phase() {
693693
# Fresh install if required
694694
if [[ "$requires_fresh" == "true" ]]; then
695695
platform_uninstall
696+
# Reset device identity so the AppsFlyer server treats this as a brand-new
697+
# device and returns is_first_launch=true.
698+
if [[ "$PLATFORM" == "android" ]]; then
699+
local new_id
700+
new_id=$(cat /proc/sys/kernel/random/uuid 2>/dev/null | tr -d '-' | head -c 16 || date +%s%N | head -c 16)
701+
adb shell settings put secure android_id "$new_id" 2>/dev/null || true
702+
log_info "Reset android_id to $new_id for fresh-install attribution"
703+
else
704+
xcrun simctl privacy "$IOS_UDID" reset all 2>/dev/null || true
705+
log_info "Reset simulator privacy settings for fresh-install attribution"
706+
fi
696707
sleep 1
697708
if ! platform_install; then
698709
log_fail "Installation failed — aborting phase"

0 commit comments

Comments
 (0)