mixpanel / mixpanel-flutter

Official Flutter Tracking Library for Mixpanel Analytics
https://mixpanel.com
Apache License 2.0
67 stars 75 forks source link

Why events tracked on IOS are not show on 'Live View' list? #16

Closed istidanaharjanti closed 3 years ago

istidanaharjanti commented 3 years ago

hi, i've got a problem while setting up mixpanel-flutter into my project. Events tracked on IOS not being recorded by Mixpanel, meanwhile it is recorded well on android. Is this a known issue? What should i do? Thank you!

i use mixpanel_flutter ^1.0.0 and here's my flutter doctor:

[✓] Flutter (Channel unknown, 2.0.3, on macOS 11.4 20F71 darwin-x64, locale en-ID)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Community Edition (version 2021.1.2)
[✓] VS Code (version 1.57.0)

here's the result on Live View menu:

Screen Shot 2021-06-28 at 12 56 48

only Android on the list, no IOS even though i already did trigger event on IOS.

zihejia commented 3 years ago

hi @istidanaharjanti , to preserve battery life and customer bandwidth, the Mixpanel library doesn't send the events you record immediately. Instead, it sends batches to the Mixpanel servers every 60 seconds while your application is running, as well as when the application transitions to the background. You can call flush() manually if you want to force a flush at a particular moment.

mixpanel.flush();

If your events are still not showing up after 60 seconds, check if you have opted out of tracking. You can also enable Mixpanel debugging and logging, it allows you to see the debug output from the Mixpanel library. To enable it, call setLoggingEnabled to true, then run your iOS project with Xcode. The logs should be available in the console.

mixpanel.setLoggingEnabled(true);

If it is still not working, could you paste the log from Xcode?

istidanaharjanti commented 3 years ago

hi @zihejia thank you for the answer. yes the IOS's logs still unavailable on list until today. already set the opted out of tracking as false as you provide from example.

tried debug it with setLoggingEnabled and this the result:

W/MixpanelAPI.SysInfo( 1179): Permission READ_PHONE_STATE not granted. Property $radio will not be available

maybe this issue happened because of this? what should i do with this?

EDIT: but, i just realized it is debug result on android. there's no such thing on IOS. let me try run it on Xcode.

and here's error from Xcode:

Screen Shot 2021-07-01 at 03 14 39
zihejia commented 3 years ago

Hi @istidanaharjanti , it seems your iOS project did not successfully build with Mixpanel. Could you try the our latest version(1.1.0), and clean all your Xcode build cache and CocoaPods cache and try again?

istidanaharjanti commented 3 years ago

@zihejia i already did what you said above. there's no error build anymore. but still, IOS's events don't show on list.

zihejia commented 3 years ago

hi @istidanaharjanti , could you open your iOS project with Xcode, and paste what you've got in Xcode console(with setLoggingEnabled as true)? If you configured properly, you should be able to see something like this:

image

And the logs will tell you what's going on.

istidanaharjanti commented 3 years ago

hi @zihejia thank you for answering. there is:

Screen Shot 2021-07-02 at 11 06 08

but no error caught there and all IOS's events still not show on list "Live View". I also tried with example project here, and IOS's events not show on list as well, Android only.

zihejia commented 3 years ago

hi @istidanaharjanti , could you paste the full log including the part showing events being flushed and with the server address? Do you find any API call error?

istidanaharjanti commented 3 years ago

@zihejia here's what i get (no server address on logs and no flush because i don't call flush() ):

[Mixpanel - MixpanelInstance.swift - func loggingEnabled] (info) - Logging Enabled
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - adding event to queue
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - ["event": "$identify", "$mp_metadata": ["$mp_session_seq_id": 3, "$mp_event_id": "4e1c8f77704e94dd", "$mp_session_id": "7523f8cab44de6a8", "$mp_session_start_sec": 0], "properties": ["Email": "nanana@guerrillamailblock.com", "companyId": "00000339", "$device_id": "B1988160-42DD-409C-B678-D76373077475", "Identity": "00022223", "$lib_version": "1.1.0", "$os": "iOS", "$screen_width": 375, "Phone": "+628521571718356", "$manufacturer": "Apple", "$app_version_string": 2.4.3.0, "$app_build_number": 93, "$user_id": "00022223", "$anon_distinct_id": "B1988160-42DD-409C-B678-D76373077475", "$wifi": true, "mp_lib": "flutter", "company": "Cortez-Barnes", "$os_version": "14.5", "token": "5adbd060e2cdbac33e41b04a1e339859", "$screen_height": 667, "$radio": "None", "time": 1625198730, "distinct_id": "00022223", "$carrier": "", "$model": "x86_64", "Name": "Michael Welch"]]
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - adding event to queue
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - ["$mp_metadata": ["$mp_session_seq_id": 4, "$mp_event_id": "61ab29f124f8ca22", "$mp_session_id": "7523f8cab44de6a8", "$mp_session_start_sec": 0], "event": "TRANSFER_BUTTON_CLICKED", "properties": ["$radio": "None", "token": "5adbd060e2cdbac33e41b04a1e339859", "$wifi": true, "Email": "nanana@guerrillamailblock.com", "$carrier": "", "$user_id": "00022223", "Identity": "00022223", "$screen_width": 375, "page": "Transfer Screen 1.0", "membershipFee": "0.0", "$device_id": "B1988160-42DD-409C-B678-D76373077475", "Name": "Michael Welch", "distinct_id": "00022223", "requestedAmount": "10000.0", "$os_version": "14.5", "Phone": "+628521571718356", "$screen_height": 667, "$model": "x86_64", "$lib_version": "1.1.0", "$app_build_number": 93, "$os": "iOS", "$manufacturer": "Apple", "companyId": "00000339", "$app_version_string": 2.4.3.0, "time": 1625198923, "company": "Cortez-Barnes", "mp_lib": "flutter", "userId": "00022223"]]
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - adding event to queue
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - ["$mp_metadata": ["$mp_session_seq_id": 5, "$mp_session_id": "7523f8cab44de6a8", "$mp_event_id": "2f0344c8e1455279", "$mp_session_start_sec": 0], "event": "TRANSFER_BUTTON_CLICKED", "properties": ["$lib_version": "1.1.0", "$carrier": "", "page": "Transfer Screen 1.0", "$radio": "None", "mp_lib": "flutter", "distinct_id": "00022223", "membershipFee": "0.0", "$screen_height": 667, "Identity": "00022223", "$app_version_string": 2.4.3.0, "companyId": "00000339", "Name": "Michael Welch", "time": 1625198933, "requestedAmount": "100000.0", "token": "5adbd060e2cdbac33e41b04a1e339859", "userId": "00022223", "Phone": "+628521571718356", "company": "Cortez-Barnes", "$wifi": true, "$device_id": "B1988160-42DD-409C-B678-D76373077475", "$model": "x86_64", "$app_build_number": 93, "$manufacturer": "Apple", "$os": "iOS", "$screen_width": 375, "$user_id": "00022223", "Email": "nanana@guerrillamailblock.com", "$os_version": "14.5"]]
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - adding event to queue
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - ["properties": ["$user_id": "00022223", "$app_version_string": 2.4.3.0, "companyId": "00000339", "Name": "Michael Welch", "Identity": "00022223", "$screen_height": 667, "$os": "iOS", "$carrier": "", "userId": "00022223", "Email": "nanana@guerrillamailblock.com", "distinct_id": "00022223", "company": "Cortez-Barnes", "$model": "x86_64", "$manufacturer": "Apple", "$radio": "None", "$os_version": "14.5", "time": 1625198935, "$screen_width": 375, "Phone": "+628521571718356", "$device_id": "B1988160-42DD-409C-B678-D76373077475", "requestedAmount": "100000.0", "membershipFee": "0.0", "$app_build_number": 93, "$wifi": true, "page": "Transfer Screen 1.1", "mp_lib": "flutter", "token": "5adbd060e2cdbac33e41b04a1e339859", "$lib_version": "1.1.0"], "event": "LANJUT_BUTTON_CLICKED", "$mp_metadata": ["$mp_event_id": "0e53c00270d3e246", "$mp_session_seq_id": 6, "$mp_session_id": "7523f8cab44de6a8", "$mp_session_start_sec": 0]]
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - adding event to queue
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - ["properties": ["$wifi": true, "$app_version_string": 2.4.3.0, "Name": "Michael Welch", "requestedAmount": "100000.0", "userId": "00022223", "$carrier": "", "$radio": "None", "companyId": "00000339", "$os": "iOS", "membershipFee": "0.0", "company": "Cortez-Barnes", "$screen_height": 667, "$screen_width": 375, "$lib_version": "1.1.0", "$device_id": "B1988160-42DD-409C-B678-D76373077475", "$os_version": "14.5", "page": "Transfer Screen 1.1", "Phone": "+628521571718356", "$model": "x86_64", "$user_id": "00022223", "mp_lib": "flutter", "distinct_id": "00022223", "time": 1625198939, "Identity": "00022223", "$manufacturer": "Apple", "token": "5adbd060e2cdbac33e41b04a1e339859", "$app_build_number": 93, "Email": "nanana@guerrillamailblock.com"], "event": "LANJUT_BUTTON_CLICKED", "$mp_metadata": ["$mp_event_id": "bad0beeb998940d7", "$mp_session_seq_id": 7, "$mp_session_id": "7523f8cab44de6a8", "$mp_session_start_sec": 0]]
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - adding event to queue
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - ["event": "TRANSFER_BUTTON_CLICKED", "$mp_metadata": ["$mp_session_start_sec": 0, "$mp_session_seq_id": 8, "$mp_session_id": "7523f8cab44de6a8", "$mp_event_id": "55941d741f8b7c0f"], "properties": ["$app_build_number": 93, "token": "5adbd060e2cdbac33e41b04a1e339859", "time": 1625199047, "Identity": "00022223", "$screen_width": 375, "$os": "iOS", "distinct_id": "00022223", "userId": "00022223", "$user_id": "00022223", "$screen_height": 667, "$app_version_string": 2.4.3.0, "$radio": "None", "mp_lib": "flutter", "$os_version": "14.5", "Name": "Michael Welch", "$carrier": "", "Email": "nanana@guerrillamailblock.com", "page": "Transfer Screen 1.0", "requestedAmount": "10000.0", "company": "Cortez-Barnes", "Phone": "+628521571718356", "$manufacturer": "Apple", "$device_id": "B1988160-42DD-409C-B678-D76373077475", "membershipFee": "0.0", "$wifi": true, "$model": "x86_64", "$lib_version": "1.1.0", "companyId": "00000339"]]
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - adding event to queue
[Mixpanel - Track.swift - func track(event:properties:eventsQueue:timedEvents:superProperties:distinctId:anonymousId:userId:hadPersistedDistinctId:epochInterval:)] (debug) - ["properties": ["companyId": "00000339", "token": "5adbd060e2cdbac33e41b04a1e339859", "Name": "Michael Welch", "page": "Transfer Screen 1.1", "$screen_width": 375, "$os": "iOS", "$screen_height": 667, "requestedAmount": "10000.0", "$lib_version": "1.1.0", "Phone": "+628521571718356", "$app_build_number": 93, "$carrier": "", "$manufacturer": "Apple", "userId": "00022223", "$model": "x86_64", "mp_lib": "flutter", "$user_id": "00022223", "$radio": "None", "membershipFee": "0.0", "company": "Cortez-Barnes", "Email": "nanana@guerrillamailblock.com", "distinct_id": "00022223", "time": 1625199048, "$wifi": true, "$app_version_string": 2.4.3.0, "$os_version": "14.5", "$device_id": "B1988160-42DD-409C-B678-D76373077475", "Identity": "00022223"], "$mp_metadata": ["$mp_event_id": "4593632408b4dc44", "$mp_session_id": "7523f8cab44de6a8", "$mp_session_start_sec": 0, "$mp_session_seq_id": 9], "event": "LANJUT_BUTTON_CLICKED"]
zihejia commented 3 years ago

hi @istidanaharjanti , If there is no flush, no events will be sent to Mixpanel. What if you put the app in the background and relaunch the app or call flush() just to make the events flush to Mixpanel. Then you can check the Liveview, if it still doesn't show. Could you paste the part for the API request? The log should tell you what's going on.

Below is from our FAQ section(https://github.com/mixpanel/mixpanel-flutter#faq) on the Github page, hope that helps!

Why aren't my events showing up?

To preserve battery life and customer bandwidth, the Mixpanel library doesn't send the events you record immediately. Instead, it sends batches to the Mixpanel servers every 60 seconds while your application is running, as well as when the application transitions to the background. You can call flush() manually if you want to force a flush at a particular moment.

mixpanel.flush();

istidanaharjanti commented 3 years ago

hi @zihejia i did as you told. and now it is successfully appear on Live View by flush! Thank you for your help