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 Google Analytics only_pageview mode to GA4 #649

Merged
merged 1 commit into from
Nov 29, 2023
Merged

Update Google Analytics only_pageview mode to GA4 #649

merged 1 commit into from
Nov 29, 2023

Conversation

maple3142
Copy link
Contributor

PR Checklist

PR Type

  • Bugfix.
  • Feature.
  • Improvement.
  • Code style update (formatting, linting).
  • Refactoring (no functional changes).
  • Documentation.
  • Translation.
  • Other... Please describe: Replace the usage of the to be depreacted Universal Analytics measurement protocol api with the new api. (source)

What is the current behavior?

The custom pageview sending code (will be used when only_pageview is enabled) is using the old measurement protocol api.

What is the new behavior?

Use the new GA4 measurement protocol api instead: https://developers.google.com/analytics/devguides/collection/protocol/ga4

  • Link to demo site with this changes:
  • Screenshots with this changes:

How to use?

Create a new Google Analytics 4 resource, and get api_secret according to the instruction described here.

In NexT _config.yml:

google_analytics:
  tracking_id: G-XXXXXXXXXX  # Measurement ID
  only_pageview: true
  measure_protocol_api_secret: # api secret

@welcome
Copy link

welcome bot commented May 2, 2023

Thanks so much for opening your first PR here!

@CLAassistant
Copy link

CLAassistant commented May 2, 2023

CLA assistant check
All committers have signed the CLA.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 4858498581

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.614%

Totals Coverage Status
Change from base Build 4837883490: 0.0%
Covered Lines: 394
Relevant Lines: 399

💛 - Coveralls

{
name : 'page_view',
params: {
page_location: location.href,

Check warning

Code scanning / CodeQL

Client-side cross-site scripting (experimental)

(Experimental) This may be a cross-site scripting vulnerability due to [a user-provided value](1). Identified using machine learning.
@r12f
Copy link
Contributor

r12f commented May 19, 2023

Will be nice if we could get this change up to date and in. The old GA is going away soon.

@ppodds
Copy link

ppodds commented Nov 27, 2023

@maple3142 Can you change this Pull request to open?

@maple3142 maple3142 marked this pull request as ready for review November 27, 2023 18:46
@ppodds
Copy link

ppodds commented Nov 29, 2023

@stevenjoezhang Could you merge this pull request? Old GA is already deprecated.

@stevenjoezhang stevenjoezhang added this to the 8.18.3 milestone Nov 29, 2023
@stevenjoezhang stevenjoezhang merged commit 9bd24f7 into next-theme:master Nov 29, 2023
2 of 5 checks passed
Copy link

welcome bot commented Nov 29, 2023

Congrats on merging your first pull request here! 🎉 How awesome!

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

Successfully merging this pull request may close these issues.

6 participants