Google Analytics 4 support

Any news when Google Analytics 4 support will be added - I know UA support is still available but without migration of UA it would be easier to start collecting under GA4 so the data isnt split. I see the API is described here User properties | Measurement Protocol for Google Analytics 4 | Google Developers so maybe this will be a starter. If no one has started then happy to take a look.

I may have misunderstood current support but any advice welcome on this front.

Hi Tom.

We have our team meeting today. I will bring this up.


I second that. I keep getting warnings about discontinuation of UA, though it’s not clear to me from the message if UA will stop working or not. For reference, here’s the latest message:

Universal Analytics standard properties will stop processing data on July 1, 2023. To maximize historical data and to ensure that Google Analytics 4 (GA4) meets your specific needs, we recommend you make the switch to Google Analytics 4 now. This will give you the opportunity to customize the setup including using the latest site tag.
For any customer who does not set up a GA4 property with basic settings, starting in March, we will configure one with a few basic settings consistent with the existing Universal Analytics property; this includes certain conversion events, Google Ads links, and existing website tags.

For Universal Analytics customers whose websites are tagged with gtag.js or analytics.js (including through tag management systems like Google Tag Manager), we will create a connected site tag that will reuse existing tags when possible to send traffic to the new GA4 property. If you do not wish to have a GA4 property created and configured based on your Universal Analytics property and existing tags, you may opt-out.

Hey @tomgreen66 .

This is something that we will have to plan out. I noticed that you mention that you are willing to take a look and work on it. If that is the case, please feel to do so. If you have questions, please feel free to ask them in this topic.


Apologies for silence, Lustre, networking and other issues all got in the way. Back on this strand of work so if still useful I will see what I can get working.

That’s great. Thanks Tom!!!


Been taken a look. There seems to be a version 2 API which looks similar to the current version 1 API used with wget to send information to current UA implementation. For GA4 it seems it wants to post events via json - e.g. Sending events  |  Measurement Protocol for Google Analytics 4  |  Google Developers - also Google seem very keen not to upload any personal identifiable information - are usernames included into this? See: Measurement Protocol, SDK und User-ID-Funktionsrichtlinie  |  Measurement Protocol for Google Analytics 4  |  Google Developers. There does seem some 3rd party documentation on parameters Google Analytics 4 . Measurement Protocol Definition - since OOD does not use gtag which I think does the magic to covert old UA to GA4 I think the current implementation might stop working when UA is switched off.

I’m circling back to this now after promising @mcuma that it would be in 3.0.1 and completely forgot. It’s not in 3.0.1.

In fact, looking at it now - it may be a heavy lift for us as we’re passing everything in query parameters and apparently GA4 uses json bodies instead.

I’m looking to make updates for this this week, but I don’t know at the onset how much of a breaking change this is going to be and if I want to introduce those changes in 3.0.

Sounds good Jeff, I haven’t set up 3.0 on our systems yet but am hoping to do it on our test OOD instance in the next few weeks.

I don’t know if this’ll make it into 3.0 as it’s either a large update to the lua scripts we have (which isn’t going into 3.1) or adding HTML & configurations to the dashboard which seems odd for a patch release.

You can hot patch your systems in this way:

  • copy /var/www/ood/apps/sys/dashboard/app/views/layouts/application.html.erb to /etc/ood/config/apps/dashboard/views/layouts/application.html.erb
  • edit the file in /etc (not the file in /var!) adding this near the top.
  • replace abc123 with your actual tag id.
<%- tag_id = 'abc123' -%>

<%- unless tag_id.nil? -%>
<!-- Google tag (gtag.js) -->
<script async src="<%= tag_id %>"></script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', '<%= tag_id %>');
<%- end -%>

With that update, the dashboard will pull your edited file with the GA scripts enabled instead of the default html that we ship.

Hi Jeff, thanks for looking into this. Will this hot patch also work on OOD 2.0? Thanks.

Yea, for anyone else, I believe this patch will work for many past versions. The facility to override partials (you’re overriding our main application.html.erb partial here) has existed maybe forever.

The hot fix seems to be working - on our test instance so far. I went to the GA webpage and with their prompts created a new GA4 property based on the old UA property, and then used the “Measurement ID” for the “tag_id”. I’ll observe the behavior for the next day or two and if all is good put it to our production servers.


Thanks! let me know if there are issues.