Reply New Topic
2023/2/20 9:48:07
#1
Offline
Webmaster

Moving on from Google Universal Analytics

Universal Analytics will be deactivated in a few months. If your site uses it, you will have received already quite a few reminders about moving to Google Analytics 4. But keep in mind that the data cannot be transferred.

Sunsetting a product is always a risk to retain users, as at that moment you force them to think about their needs, and perhaps they arrive at the conclusion that their needs are better met elsewhere.

ImpressCMS has been solely supporting UA in the past (we even come from the predecessor, but that's a long time ago). Perhaps in the future we should look into opening up this interface and making it possible to easily add new analytics products, and to have multiple analytics options simultaneously active.

I've played with a first version of a GA4 preload and it works more or less how it should : activating the plugin adds the GA4 javascript on the right location in the page. Future improvements will be:

  • make it possible to have multiple Analytics products active simultaneously on your page
  • Make it possible to customize the functionality with preload-specific configuration items

But for now, let's make it so that users are supported in migration from UA to GA4


_________________

Me on Ohloh

2023/2/21 20:13:30
#2
Offline
Home away from home

Re: Moving on from Google Universal Analytics

As I mentioned in another thread, this is something we need to address sooner rather than later. This is a bit tricky for us, because we have no way of determining if a site has gone through the migration from UA to GA4. All we store is the site code and if it is enabled, we pass the code to the core and it inserts the javascript on every page.

This could turn into a whole lot of different scenarios and options to handle through the core admin UI. Or, we can add documentation on how to add preloads that each admin would need to customize before deploying on their sites. Even now, I think of a preload generator that would allow an admin to paste in the code snippet from the other provider, select where it loads, and be able to manage it that way. That's for a later release.

For immediate consideration is what do we put into the new 2.0 release? My first reaction is to keep it simple - provide a GA4 preload template that admins can customize with their tag and include on their sites. The UA portion would remain and not interact with the GA4 plugin. Admins would need to determine the impact of having both active on a site. We deprecate the UA code with this release and move towards a more easily customized solution, removing the UA portions in a later release this year.


_________________
Christian Web Resources
Facebook
2023/2/22 3:30:33
#3
Offline
Just can not stay away

Re: Moving on from Google Universal Analytics

I think turning this into module would be a great idea.

Yes, many use Google but not everyone. Sometimes other analytics tools are better.


2023/3/2 19:44:39
#4
Offline
Home away from home

Re: Moving on from Google Universal Analytics

I was thinking - Custom Tags already provides a lot of the flexibility to add other snippets anywhere. What it still requires is a way to insert your tag without having to manually edit a template, if you want something to be in the header of your pages. If it can go in the body, you're set.


_________________
Christian Web Resources
Facebook
2023/3/5 5:41:07
#5
Offline
Webmaster

Re: Moving on from Google Universal Analytics

Short term : can't we simply add an extra field to the ACP where users can put their GA4 number? That would allow both Universal Analytics and GA4 to coexist for the time being.

The idea of custom tags it not bad, but configuration of these features should always be kept limited to the ACP, so even if you define a custom tag to include GA4 or Fathom or any other service, we will need to figure out a way to define these identifiers freely in the ACP as well.


_________________

Me on Ohloh

2023/3/5 16:45:28
#6
Offline
Home away from home

Re: Moving on from Google Universal Analytics

I was thinking along the lines of using the existing UA field and having it do some double duty. Do nothing and we assume, based on the format of the tag, that it's for UA. If you have switched to GA4, include the G- at the beginning of the tag and we'll load the proper snippet.

Using the preloads is a good idea - I think we should go that route for this round. The next phase will be to find a better way to insert and manage them from the control panel.


_________________
Christian Web Resources
Facebook
2023/3/6 2:52:02
#7
Offline
Webmaster

Re: Moving on from Google Universal Analytics

That's certainly a viable solution. I'll take care of that this evening.


_________________

Me on Ohloh

2023/3/13 2:18:49
#8
Offline
Webmaster

Re: Moving on from Google Universal Analytics

Later than planned, but here is a first try : https://github.com/ImpressCMS/impresscms/pull/1429 


_________________

Me on Ohloh

2023/5/19 18:43:01
#9
Offline
Home away from home

Re: Moving on from Google Universal Analytics

I've reviewed the PR - could someone else have a look at it, too?


_________________
Christian Web Resources
Facebook
2023/6/24 15:30:17
#10
Offline
Home away from home

Re: Moving on from Google Universal Analytics

Here's a patch, if anyone wants to implement this and already haven't found a way to do it. I've bundled the files for both v1.3.11 and v1.4.4 into a single file.

There are 2 files to be concerned with - /libraries/icms/view/theme/Object.php and /plugins/preloads/googleanalytics.php. Make a backup of the first and replace with the file from the package for your version. Add the 2nd to the preloads folder.

Without any other changes, you should still be gathering data with the Universal Analytics tag. To us the new GA4 tag, you'll need to create a new property in Google Analytics to get your new tag. When you have it, update the value in your admin control panel of your site - Admin / Preferences / Meta + Footer. When you put in the new tag, include G- with the value. This is how ImpressCMS will know whether to use the UA version or the GA4 version.


Attach file:


zip GA4.zip Size: 19.22 KB; Hits: 89

_________________
Christian Web Resources
Facebook
2023/7/10 5:42:54
#11
Offline
Webmaster

Re: Moving on from Google Universal Analytics

Small update on this : this patch is released in the 1.4.5 version which, essentially, applies the patch on top of 1.4.4

See the release announcement:


_________________

Me on Ohloh

Reply New Topic extras
 Previous Topic   Next Topic
You can view topic.
You can start a new topic.
You can reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You can post without approval.