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

Update to GA4 #55

Merged
merged 25 commits into from
Mar 14, 2024
Merged

Update to GA4 #55

merged 25 commits into from
Mar 14, 2024

Conversation

driftingly
Copy link
Member

@driftingly driftingly commented Mar 5, 2024

This PR adds support for GA4.

  • Updates spatie/laravel-analytics to 5.2.1
    • Drops support for Laravel 9

Changes between 4.1.0 and 5.2.1

Important

Changes env variable from ANALYTICS_VIEW_ID to ANALYTICS_PROPERTY_ID

Comparing metrics: Google Analytics 4 vs. Universal Analytics Comparing metrics

Universal Analytics to Google Analytics 4 dimensions and metrics equivalence

Changes

  • Accessing Analytics through the facade now
  • performQuery has been renamed to get
  • view id has been updated to property id
  • Metric changes
    • ga:pageviews => screenPageViews
    • ga:year => year
    • ga:users => totalUsers
    • ga:1dayUsers => active1dayUsers
    • ga:7dayUsers => active7dayUsers
    • ga:28dayUsers => active28dayUsers
    • ga:sessions => sessions
    • ga:avgSessionDuration => averageSessionDuration
  • Dimension changes
    • ga:pageTitle => pageTitle
    • ga:hostname => hostName
    • ga:pagePath => pagePath
    • ga:fullReferrer => pageReferrer
    • ga:country => country
  • Analytics data results changes
    • pageViews => screenPageViews
  • Removed FourteenDayActiveUsersMetric
    • GA4 doesn't support 14-day active users, only daily, weekly, and monthly
  • Migrating away from deprecated assertObjectHasAttribute to assertObjectHasProperty
  • Fixes UI issues with FilterMenu.vue, MostVisitedPages.vue, ReferrerList.vue
  • Removes columns not available in GA4 from Tool.vue page

Testing

Following the instructions on the Spatie docs I created a project and configured Google Analytics Data API access. Then, I created a Google Analytics account for a local testing domain.

Closes #54
Closes #53
Closes #49

Copy link
Member

@mattstauffer mattstauffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I skimmed through everything and it all seems pretty reasonable. Haven't actually loaded it up on a site though. Do we need an upgrade guide or anything else?

composer.json Show resolved Hide resolved
@driftingly driftingly merged commit 3445d73 into main Mar 14, 2024
6 checks passed
@driftingly driftingly deleted the drift/ga4-update branch March 14, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants