Many Pies

Many Pies

Monday, March 27, 2023

Google analytics engagement time not working - how I found out the problem

A graph showing a zigzag line, but on the left hand scale the scale values are all zero. At the top it says the average engagement time is zero.

This is very niche, and is mainly of interest if you're using the Webtoffee Cookie consent plugin (there is a free version available too). However, if you're interested in debugging analytics problems, then this gives you some techniques.

The problem showed itself that the engagement time on our GA4 analytics was zero. As you can see from the graph above, not exactly zero, but certainly very small. I turned to webmasters.stackexchange.com and got a response from jen. It didn't give me the answer, but pointed me to an analytics debugger extension for Chrome. I could see that using that the engagment time (_et parameter) wasn't zero, but was a small number of milliseconds, less than 50.

I tried a number of things on the cookie plugin settings, such as putting the Google Tag Manger code into cookie categories, as recommend by this article (only for the free plugin though). That made the analytics script run when you accepted the cookies, but never after that. I tried disabling it, but it still didn't make engagement time get registered.

In the end though, the problem was that there was code in our site theme designed to work with GTM, but we hadn't been asked to do the corresponding changes in our GTM config. Once I removed that code the engagement time was a healthy number of seconds. I don't quite know why that caused this problem, but my theory is that the events it was triggering ran pretty quickly after the page loaded, and at that point the user engagement was recorded on those events, rather than when the user subsequently did something (scroll, navigate).

Other things to help with debugging

  • Chrome application tab, cookie section, has a handy clear all cookies button to the right of the filter box.
  • Make sure you enable the analytics debugger extension when trying to debug!
  • Clear the site cache after making changes to the cookie plugin settings

Friday, March 10, 2023

What's the difference between disconnecting from a remote computer and logging off?

 I put this in one of our internal chatrooms, but it may be useful generally.

Some people are disconnecting from remote computers (using Remote Desktop) and not logging off when asked. If you disconnect all your programs are still running, even though you can't see them. If you log off, they're all closed down. Disconnecting is like leaving an office with your stuff all over your desk. Logging off is like putting everything away and leaving your desk clear, before you then leave the office. I got Dall-E to illustrate these:

Disconnecting:

a woman walking out of an office door with books and papers still on the desk
Logging off

a man walking out of an office leaving a clear desk behind
To disconnect:
To log off (ok, sign out is the new fangled word for it)


Click on that icon of a person to get the sign out option