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

Send Analytics measurement ID with script tag request #4434

Merged
merged 1 commit into from
Feb 11, 2021

Conversation

hsubox76
Copy link
Contributor

@hsubox76 hsubox76 commented Feb 8, 2021

Confirmed with gtag team that including measurementId in initial script tag request does not trigger a page_view event. page_view is in fact triggered on first config call. Tested this out as well.

We now wait for measurementID to be fetched from the dynamic config endpoint, then insert the script tag. All events sent with firebase.analytics() are still queued until after all initialization requests complete, so the delay shouldn't cause any problems?

This should prevent 2 downloads of gtag reported by users here: #2628 which causes a cluttered and confusing log when using the Google Analytics Debugger chrome extension.

I'm still not sure if the double download causes any functionality issues (I don't think so) but it seems to make it distracting and confusing when diagnosing other analytics problems.

(Observed results: There are 2 events sent, one is user_engagement, and one is page_view, they both seem to be sent properly with FID and are viewable in the Firebase console dashboard.)

I will make a separate PR for exp if this approach is good.

@hsubox76 hsubox76 requested a review from Feiyang1 as a code owner February 8, 2021 20:50
@changeset-bot
Copy link

changeset-bot bot commented Feb 8, 2021

⚠️ No Changeset found

Latest commit: ceb03ad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

Binary Size Report

Affected SDKs

  • @firebase/analytics

    Type Base (e8811c0) Head (40217dc) Diff
    esm2017 18.6 kB 18.7 kB +90 B (+0.5%)
    main 24.4 kB 24.5 kB +91 B (+0.4%)
    module 23.3 kB 23.4 kB +91 B (+0.4%)
  • firebase

    Type Base (e8811c0) Head (40217dc) Diff
    firebase-analytics.js 35.6 kB 35.7 kB +40 B (+0.1%)
    firebase.js 856 kB 856 kB +40 B (+0.0%)

Test Logs

@google-oss-bot
Copy link
Contributor

Size Analysis Report

Affected Products

No changes between base commit (e8811c0) and head commit (40217dc).

@hsubox76 hsubox76 merged commit 384b64d into master Feb 11, 2021
@hsubox76 hsubox76 deleted the ch-analytics-download branch February 11, 2021 17:02
@firebase firebase locked and limited conversation to collaborators Mar 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants