London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Manh Hung Nguyen
Apr 12, 2023
  2653
(2 votes)

EPiServer.GoogleAnalytics now support Google Analytics GA4

As you know Google Analytics 4 is replacing Universal Analytics. On July 1, 2023, your Universal Analytics properties will stop collecting data. Only GA4 properties will collect data after July 1.

We have just released the latest version of the EPiServer.GoogleAnalytics package, version 4.0, in which you can now display GA4 analytics data on your site. And note that with this version 4.0, you will only be able to use it with a Google Analytics account that has already added the GA4 property. Instructions for migrating data from Universal Analytics to Google Analytics 4 can be found here.

Installation

* Install from Optimizely nuget

Setting up tracking script

* Add MeasurementId:

Step 1: Get your MeasurementId:

Go to Google Analytics > Admin > Data Streams > Web stream details > Stream details > Copy MEASUREMENT ID

Step 2: Add your MeasurementId to your site:

Go to Edit Mode > Addons > GoogleAnalytics > Admin > Configure Tracking > All Sites > Select Google Analytics 4 > Paste MEASUREMENT ID

* Custom Tracking Script:

Go to Edit Mode > Addons > GoogleAnalytics > Admin > Configure Tracking > All Sites > Select Custom Tracking Script > Paste this code with your MeasurementId:

Enable debug mode

To monitor events from your website as Analytics collects them in DebugView of Google Analytics, add this code in Startup.cs

For more details about the configuration, you can refer to our online documentation

Apr 12, 2023

Comments

Please login to comment.
Latest blogs
Meet the Newest OMVPs – Winter 2025 Cohort

We're excited to officially welcome the latest winter cohort of Optimizely Most Valuable Professionals (OMVPs) - a group of passionate tech...

Satata Satez | May 14, 2025

Helper method to encode query string properly

When using Url.ContentUrl() in Optimizely 12, encodes spaces as + in the query string. If you want to encode the spaces as %20, use the below helpe...

sunylcumar | May 13, 2025

Get ContentReference from GUID

Optimizely CMS 12 provides a Utility function to retrieve Content Reference from a Guid by ussing the below static method. var contentReference =...

sunylcumar | May 13, 2025

Creating a Dropdownlist in Optimizely CMS: Populate ISelectionFactory with values from another block's properties

Create a Block to hold selection options using EPiServer.Cms.Shell.UI.ObjectEditing.EditorDescriptors; using EPiServer.PlugIn; using EPiServer.Shel...

sunylcumar | May 12, 2025

Opal AI available in Optimizely CMS (SaaS)

Use Opal AI to translate your content!

Tomas Hensrud Gulla | May 12, 2025 |

Get Up to Speed with Optimizely Opal: Quick Start Resources

Exciting New Feature Updates to Optimizely Opal: Elevating Your Product Experience We're thrilled to announce the launch of massive feature updates...

Patrick Lam | May 9, 2025