Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behavior at session and first-user level with attribution sent via campaign_details or firebase_campaign events #6627

Closed
giovaniortolani opened this issue Jan 16, 2025 · 7 comments

Comments

@giovaniortolani
Copy link

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 2024.1.2 Patch 1
  • Firebase Component: Analytics
  • Component version: 22.1.2

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

I'm running some tests on Firebase Analytics and came across one weird behavior regarding attribution using the campaign_details (manual event) and firebase_campaign (automatic event).

Test cases:
  1. Start session 1, send campaign_details with attribution X, let the session expire, start session 2, and send campaign_details with attribution Y.
  2. Start session 1 directly, let the session expire, start session 2, and send campaign_details with attribution Y.
  3. Start session 1 through a deep link, let the firebase_campaign (automatic event) fire, let the session expire, start session 2, and send campaign_details with attribution Z.
  4. Same as test number 3, but also (!) send campaign_details in session 1.
  5. Same as test number 2, but using a deep link and firebase_campaign (automatic event) in the second session instead of campaign_details.
  6. IGNORE.
  7. Start session 1 and send campaign_details, let the session expire, and start session 2 directly (no attribution information is sent in the second session).
  8. Start session 1 on day 1 and send campaign_details with attribution X. On the next day (day 2), start session 2 and send campaign_details with attribution Y.
Conclusions:
  1. For some reason, the attribution of a later session affects the attribution of a previous session on the same day.
    This screenshot corresponds to the 1st test case described above. The same behavior can be observed in the other test cases.
    Image

  2. There's also a weird behavior for sessions on different days.
    The attribution sent on the following session (following day) was completely ignored and instead, the attribution of the previous session (from previous day) was used. First-user attribution remained intact though.
    Image

  3. The attribution works as expected only when the next session is direct after a previous non-direct session. Meaning that the session and first-user attribution is the one from the first session.

  4. There is no difference between the firebase_campaign (automatic event - fired when accessing the app with UTMs in the deep link, or via the Play Store) and the campaign_details (manual event) in causing this strange attribution. In both cases, the behavior is the same.

  5. The result is the same on the GA4 UI and BigQuery table.

Observations:

  • no consent mode in place;
  • no User ID being sent;
  • for some of the sessions I changed the default timeout to 1 minute to facilitate testing. However, the results are the same whether using 1 minute or 30 minutes (the default value);

Relevant Code:

SQL query and raw data for tests 1-7; test 8 is not there

@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@lehcar09
Copy link
Contributor

Hi @giovaniortolani, thank you for reaching out. Can you share the verbose logs from the test cases? This would help us investigate the data that's been collected. Thanks!

@giovaniortolani
Copy link
Author

Hi @giovaniortolani, thank you for reaching out. Can you share the verbose logs from the test cases? This would help us investigate the data that's been collected. Thanks!

Hi @lehcar09, unfortunately I didn't store them.
I can reproduce the tests and share the logs with you. Would that be sufficient?

@giovaniortolani
Copy link
Author

giovaniortolani commented Jan 20, 2025

Hi @giovaniortolani, thank you for reaching out. Can you share the verbose logs from the test cases? This would help us investigate the data that's been collected. Thanks!

@lehcar09

Here are the verbose logs. I had to run the tests again because I didn't save the logs the first time, the result should be the same.

@lehcar09
Copy link
Contributor

Thank you for the the logs @giovaniortolani. I'm not that familiar with attribution. Based on the docs on how session attribution works,

The session_start event carries the information that determines the attribution of the session, such as the gclid, UTM parameters, and referrer.
The attribution model for sessions stays the non-direct last click attribution model, and the key event lookback window is determined by the "All other conversion events" setting, which is 90 days by default. Learn more about selecting or updating attribution settings.

This could be more of a data issue. Based on the logs you shared, could you confirm if the traffic source dimensions in ga_campaign (firebase_campaign) and campaign_details events are correct for all the test cases?

Test 1:
1st session: Logging event: origin=app,name=campaign_details,params=Bundle[{medium=camp_details_first_attrib, source=camp_details_first_attrib, ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=-8382573619622422780, test=test-1}]
2nd session: Logging event: origin=app,name=campaign_details,params=Bundle[{medium=camp_details_second_attrib, source=camp_details_second_attrib, ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=7370790994858109984, test=test-1}]

Test 2:
2nd session: Logging event: origin=app,name=campaign_details,params=Bundle[{medium=camp_details_second_attrib, source=camp_details_second_attrib, ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=674771222424100034, test=test-2}]

Test 3:
1st session: Logging event: origin=auto,name=ga_campaign(_cmp),params=Bundle[{medium=test-3, source=test-3, ga_event_origin(_o)=auto, campaign_info_source(_cis)=intent}]
2nd session: Logging event: origin=app,name=campaign_details,params=Bundle[{medium=camp_details_first_attrib, source=camp_details_first_attrib, ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=6892982976382681174, test=test-3}]

Test 4: 
1st session:
Logging event: origin=auto,name=ga_campaign(_cmp),params=Bundle[{medium=test-4, source=test-4, ga_event_origin(_o)=auto, campaign_info_source(_cis)=intent}]
Logging event: origin=app,name=campaign_details,params=Bundle[{medium=camp_details_first_attrib, source=camp_details_first_attrib, ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=-6286275243519489507, test=test-4}]
2nd session: Logging event: origin=app,name=campaign_details,params=Bundle[{medium=camp_details_second_attrib, source=camp_details_second_attrib, ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=556630314732882534, test=test-4}]

Test 5:
2nd session: Logging event: origin=auto,name=ga_campaign(_cmp),params=Bundle[{medium=test-5, source=test-5, ga_event_origin(_o)=auto, campaign_info_source(_cis)=intent, test=test-5}]

Test 7:
1st session: Logging event: origin=app,name=campaign_details,params=Bundle[{medium=camp_details_first_attrib, source=camp_details_first_attrib, ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=-8765376936491477221, test=test-7}]

Test 8:
1st session: Logging event: origin=app,name=campaign_details,params=Bundle[{medium=camp_details_first_attrib, source=camp_details_first_attrib, ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=8908731990222817460, test=test-8}]
2nd session: Logging event: origin=app,name=campaign_details,params=Bundle[{medium=camp_details_second_attrib, source=camp_details_second_attrib, ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=-3717155104183946270, test=test-8}]

Thanks!

@giovaniortolani
Copy link
Author

Hi @lehcar09, the event-level dimensions (collected_source and collected_medium columns on the screenshots of the first message) are correct, but not the session (session_source and session_medium columns on the screenshots of the first message) and first-user (first_user_source and first_user_medium columns on the screenshots of the first message) ones on BigQuery export and also on the GA4 UI.
These last 2 (session and first-user level) are processed after the events are ingested on GA4 collection servers.

Test Case Session Event Event-level attribution (actual) Event-level attribution (expected) Session attribution (actual) Session attribution (expected) First-user attribution (actual) First-user attribution (expected)
Test 1 1 campaign_details camp_details_first_attrib camp_details_first_attrib camp_details_second_attrib camp_details_first_attrib camp_details_second_attrib camp_details_first_attrib
Test 1 2 campaign_details camp_details_second_attrib camp_details_second_attrib camp_details_second_attrib camp_details_second_attrib camp_details_second_attrib camp_details_first_attrib
Test 2 1 - - - camp_details_second_attrib direct camp_details_second_attrib direct
Test 2 2 campaign_details camp_details_second_attrib camp_details_second_attrib camp_details_second_attrib camp_details_second_attrib camp_details_second_attrib direct
Test 3 1 firebase_campaign (ga_campaign) test-3 test-3 camp_details_first_attrib test-3 camp_details_first_attrib test-3
Test 3 2 campaign_details camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib test-3
Test 4 1 firebase_campaign (ga_campaign) test-4 test-4 camp_details_second_attrib test-4 camp_details_second_attrib test-4
Test 4 1 campaign_details camp_details_first_attrib camp_details_first_attrib camp_details_second_attrib test-4 camp_details_second_attrib test-4
Test 4 2 campaign_details camp_details_second_attrib camp_details_second_attrib camp_details_second_attrib camp_details_second_attrib camp_details_second_attrib test-4
Test 5 1 - - - test-5 direct test-5 direct
Test 5 2 firebase_campaign (ga_campaign) test-5 test-5 test-5 test-5 test-5 direct
Test 7 1 campaign_details camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib
Test 7 2 - - - camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib
Test 8 1 campaign_details camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib camp_details_first_attrib
Test 8 2 campaign_details camp_details_second_attrib camp_details_second_attrib camp_details_first_attrib camp_details_second_attrib camp_details_first_attrib camp_details_first_attrib

Thinking better, this might be a case for the GA4 or BQ export team. Would you happen to know how we can forward this bug to them? Is it possible for you to do that?
Usually, It's hard to get their attention or feedback.

@lehcar09
Copy link
Contributor

This looks more of a data issue, rather than SDK. You’re right. It would be best to reach out to the Google Analytics team to get better help on data concerns. Unfortunately, I can only recommend reaching out through Google Analytics Help Center.

Aside from that, you can try the the support options below:

With that, I’ll be closing this issue for now. Let me know if there’s any misunderstanding so we can re-open this thread. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants