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 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:


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

Thursday, February 02, 2023

We all have supercomputers now

Judson Rosebush, CC BY-SA 3.0, via Wikimedia Commons

I was watching a TV programme of 80s and 90s music videos the other day. I was marvelling at just how relatively advanced the video techniques and transitions were - such as the picture rolling up and zooming off the screen. In my mind I kept going round this little loop - "isn't that amazing for the time" - "but the technology I was using was so primitive" - "isn't that amazing for the time" - etc.

Then a realisation struck me as to why I was in this loop: These days I have access (though I don't use it) to such the type of technology that is used in, say, Avatar. I'm sure there's a bit of software out there that I could use that would do motion capture. I've heard of things like Blender which I could use to create 3d environments. I'd need to learn some stuff, I might want to buy some hardware to reduce render times, but it's all within my grasp.

In the 80s and 90s though, the height of what I could reasonably expect to be able to create myself (given time and skill) was Manic Miner and Doom. Those video effects came from computers like the Quantel Paintbox, which at $150,000 cost more than a house. (OK, not a fair comparison, as you could get houses so cheap then. It cost more than an expensive car.)

So, we all have supercomputers now. What are we doing with them?

Wednesday, December 07, 2022

Juicy questions 1: Six digit numbers and the question of patterns

Woman: I've never told anyone this before. I know I shouldn't, but I feel I can trust you. My one time code is 263827 Man:*gasp*I have a small number of questions that pop into my head from time to time. I bat them away because they're juicy and I'd like to consider them another time. I never do though. Until now though. My question, which I think I've been thinking about since I was a child, is this:
How many numbers have patterns in them?

Let's restrict it to 6 digit numbers for sake of example. My phone number used to be like this (digits have been substituted): 230191. That 191 is a pattern, as the digit 1 is repeated either side of the 9. 

I'm using one time codes in lots of places now. A lot of the time* the third and fourth numbers seem to be the same. That feels like a pattern too. As does 128348, and so on.

The key question then is, "what is a pattern?". Apart from repeated digits, can we generalise it? That is why it's a juicy question, and I'd welcome any wisdom on it.

*This is one of those hundred or so cognitive biases.

Tuesday, November 29, 2022

Secret money (if you know what I mean) - can you trust it?

I'm using the words "secret money" but you know what I mean - c----------y.

"When are you going to give us your opinion?", literally no-one has been asking. I had some vague thoughts, which never got anywhere. I mentioned this in the comments on Tim Bray's post on AWS and Blockchain

"If I could get some coherent thoughts on it I would write something about "you've got to trust somebody", like the person who created that executable that's your on-ramp to the blockchain."

Doug K said

"Bruce Schneier wrote that coherent essay, look on his website for the post Blockchain and Trust."

Here it is: Blockchain and Trust.

 "What blockchain does is shift some of the trust in people and institutions to trust in technology. You need to trust the cryptography, the protocols, the software, the computers and the network. And you need to trust them absolutely, because they're often single points of failure."

Thanks Bruce, for putting it so well.


Thursday, September 08, 2022

FormAssembly and Salesforce connectors - advanced techniques

Following on from my initial post about FormAssembly and Salesforce, here are some advanced techniques.

We use a particular technique with our FormAssembly forms and Salesforce when it comes to looking for existing contacts, creating new ones, and doing further updates on Salesforce.

The Form Submitted connector runs after the user clicks the submit button. Once it's finished the user gets the acknowledgement message, or gets redirect to the page saying it's worked. The reason we put some of our processing here, is because if it fails the user gets told with an error message. If we used the After Form Submitted connector then they wouldn't see the error message they would think it worked. Although we get emails if the connector fails, it may be a few days before someone gets round to reading that email and contacting the user to say it didn't work.

The error message won't mean much to them, as it'll be Salseforce jargon, but hopefully they'll pass it onto us and we can help them. Or if it's something that is fixable (e.g. an invalid email address) then they may retry. (FormAssembly email validation lets email addresses through that Salesforce says are invalid.)

So in the Form Submitted connector we look up the user by email, and create a contact if they don't exist.  If they do exist we also take the opportunity to update fields, like their name. Then in the After Form Submitted we look them up again. We know this will work, because the previous connector created them if necesssary. Then we do whatever the form requires, e.g.

  • if they're signing up for a subscription then add them to a campaign
  • if it's something we need to do, create a case
  • if it's giving consent for something, add a consent (we use GiveClarity's own consent system)


One problem with creating contacts like this, is that you may get a duplicate message. Even though Salesforce considers this a warning, FormAssembly considers it a fatal error. (I suggested to them that they don't do that, but I couldn't get them to understand what I mean.) So we had to set our duplicate settings on Salesforce so it does nothing about them, apart from add them to the possible duplicates report. It does mean though, that we need to be vigilant about running that report.

Do you have any tips about using FormAssembly and Salesforce together?

Wednesday, August 03, 2022

FormAssembly Salesforce connector review

One of the consultants we used for our switch to Salesforce and NPSP recommended we use FormAssembly for getting data from webforms into Salesforce. That was a very good recommendation, and so I'd like to say a bit about my experience with the FormAssembly to Salesforce integration.

FormAssembly has various integrations, Salesforce is only one of them. They can run at one of three points - when a form is loaded, when it's submitted and after it's submitted. The difference between the latter two is subtle. When you click the submit button then "when" run is one and the user gets the success page when it's complete, or an error if it fails for any reason. At that point the "after" one runs and the user is unware.

I'm not going to do a full tutorial as the FormAssembly documentation is very good. I'm just writing here to say that it's very easy to use, even if you're not a Salesforce admin. When you start using the connector you can create, update or lookup an object. Depending on how that went you can then create, update or lookup a subsidiary object and so on.

So a typical case might be that you lookup the email address on the form to find a contact with that email address. If you find them carry on to the next step, otherwise you add them. 

You can do all this by clicking around the user interface, so it's very #clicksnotcode. FormAssembly has a formula function, not specific to the Salesforce connector, and this can be used, for example, to turn two address line fields into a single Mailing Street field with a carriage return between the two lines:


tfa_nn are the internal names for the fields.

This combination of FormAssembly and Salesforce has met our needs so I'm very pleased with it.

Update: I wrote a followup post on FormAssembly and Salesforce advanced techniques