amplitude / Amplitude-Swift

Native iOS/tvOS/macOS/watchOS SDK
MIT License
26 stars 20 forks source link

Amplitude don't work with AppClip #182

Closed Chargos closed 3 months ago

Chargos commented 3 months ago

Expected Behavior

I want to see events from users who use my appClip with amplitude (https://developer.apple.com/app-clips/)

Current Behavior

I receive error 400 error from server for session.uploadTask() in HttpClient.swift file:

  error
  value : Invalid id provided: omit the user_id or device_id field if they are unknown

  key : "code"
  value : 400

  key : "events_with_invalid_fields"
  key : device_id

Apple returns "00000000-0000-0000-0000-000000000000" for identifierForVendor for all AppClips Functionality provided by SKAdNetwork isn’t available for AppClips Both name and identifierForVendor return an empty string for AppClips

Possible Solution

Apple returns "00000000-0000-0000-0000-000000000000" for identifierForVendor for all AppClips, but amplitude can generate some temp id for appClips, then I could track Appclip users (Generate some "id", save, then possibly merge events after the user installs the full version of the application, the saved identifier can be transmitted via App group shared user defaults)

Steps to Reproduce

Just create AppClip, install amplitude into it and try send some event.

Environment

crleona commented 3 months ago

This should be fixed with https://github.com/amplitude/Amplitude-Swift/pull/183, and released in 1.6.2. Note that you'll have to either set a device id or reset the amplitude instance on affected devices.