Google Optimize is the best A/B testing solution for Hugo sites in my opinion. I had the same concerns so I did some research.
If the GA tracking code is already installed on your site, all you need to do is create an Optimize account, add the Optimize tracking code to your
<head>, and link it to your GA property.
Or you can use Google Tag Manager if you don’t want to install an additional tracking code.
All your testing variants are created in the GO visual editor so you don’t need to worry about duplicate code, branching or any kind of server-side A/B testing. Plus it passes your data to Google Analytics.
It’s all done client-side with JS via Optimize.