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

Add implementation of getGoogleAnalyticsClientId #7158

Merged
merged 24 commits into from
Apr 18, 2023

Conversation

dwyfrequency
Copy link
Contributor

@dwyfrequency dwyfrequency commented Mar 26, 2023

Recently, we were presented with use cases where users wanted to log purchase and other events from their backends using Google Analytics 4 Measurement Protocol and to have those events be connected to actions taken on the client within their Firebase web app. In the event sending documentation, it dictates that app_instance_id is required for Firebase but this is only focused on Firebase for mobile. Because the JS SDK analytics package is a wrapper around gtag, we must use gtag's client_id instead of app_instance_id for Measurement Protocol. To simplify the retrieval process from our analytics packages, we will add a getGoogleAnalyticsClientId() method. getGoogleAnalyticsClientId() will retrieve an unique identifier for a web client.

@changeset-bot
Copy link

changeset-bot bot commented Mar 26, 2023

🦋 Changeset detected

Latest commit: 9357f51

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/analytics Minor
firebase Minor
@firebase/analytics-compat Patch

Not sure what this means? Click here to learn what changesets are.

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Mar 26, 2023

Size Report 1

Affected Products

  • @firebase/analytics

    TypeBase (a059af0)Merge (248c028)Diff
    browser20.9 kB21.8 kB+896 B (+4.3%)
    esm525.6 kB26.9 kB+1.38 kB (+5.4%)
    main26.9 kB28.4 kB+1.53 kB (+5.7%)
    module20.9 kB21.8 kB+896 B (+4.3%)
  • @firebase/firestore

    TypeBase (a059af0)Merge (248c028)Diff
    browser278 kB281 kB+3.02 kB (+1.1%)
    esm5346 kB350 kB+3.81 kB (+1.1%)
    main554 kB560 kB+5.56 kB (+1.0%)
    module278 kB281 kB+3.02 kB (+1.1%)
    react-native279 kB282 kB+3.02 kB (+1.1%)
  • bundle

    TypeBase (a059af0)Merge (248c028)Diff
    analytics (logEvent)43.5 kB43.7 kB+178 B (+0.4%)
    firestore (Persistence)284 kB284 kB+5 B (+0.0%)
  • firebase

    TypeBase (a059af0)Merge (248c028)Diff
    firebase-analytics-compat.js26.2 kB26.4 kB+165 B (+0.6%)
    firebase-analytics.js25.3 kB25.7 kB+434 B (+1.7%)
    firebase-compat.js757 kB757 kB+165 B (+0.0%)
    firebase-firestore.js327 kB330 kB+3.02 kB (+0.9%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/wORgKfmiEt.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Mar 26, 2023

Size Analysis Report 1

This report is too large (726,787 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/VaXnmBB9oV.html

@dwyfrequency
Copy link
Contributor Author

Still need to write the tests for the packages/analytics/src/api.ts itself but looking for general feedback on the design right now

@dwyfrequency dwyfrequency marked this pull request as draft March 27, 2023 17:57
.changeset/silent-islands-fix.md Outdated Show resolved Hide resolved
packages/analytics/src/api.ts Outdated Show resolved Hide resolved
packages/analytics/src/helpers.ts Show resolved Hide resolved
@dwyfrequency dwyfrequency marked this pull request as ready for review April 12, 2023 03:31
.changeset/silent-islands-fix.md Outdated Show resolved Hide resolved
packages/analytics/src/functions.ts Outdated Show resolved Hide resolved
packages/analytics/src/functions.ts Outdated Show resolved Hide resolved
packages/analytics/src/functions.ts Outdated Show resolved Hide resolved
packages/analytics/src/helpers.ts Outdated Show resolved Hide resolved
docs-devsite/analytics.md Show resolved Hide resolved
packages/analytics/src/functions.ts Outdated Show resolved Hide resolved
packages/analytics/src/helpers.ts Outdated Show resolved Hide resolved
@dwyfrequency dwyfrequency changed the title Add initial implementation of getGoogleAnalyticsClientId Add implementation of getGoogleAnalyticsClientId Apr 18, 2023
@dwyfrequency dwyfrequency merged commit 0a27d2f into master Apr 18, 2023
21 of 22 checks passed
@dwyfrequency dwyfrequency deleted the jd-getclientid-analytics-v2 branch April 18, 2023 20:16
@google-oss-bot google-oss-bot mentioned this pull request Apr 25, 2023
@firebase firebase locked and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants