0

So this was working on the first of the month and I've checked with the version that existed at the time. I just ran it again a few days ago and started getting this error.

Here's the full error:

Google Analytics error: tried to send hit payload length in an already assigned custom dimension

I should have noted when I originally wrote this up that it's only when running as headless that this error occurs. Removing that argument makes it work on my computer, but the goal is to run this with the headless argument.

1 Answers1

0

Custom dimensions & metrics

Custom dimensions and custom metrics are like default dimensions and metrics in your Analytics account, except you create them yourself. You can use them to collect and analyze data that Analytics doesn't automatically track.


Send Google Analytics Payload Length As Custom Dimension

Requests sent from your program / application to Google Analytics have a maximum size defined, which is commonly known as the payload size i.e. the actual content body of the request. Currently the maximum size of the payload is 8192 bytes which implies that the entire parameter string sent to Google Analytics servers can be no longer than 8192 characters in length. Incase the payload exceeds this limit, Google Analytics simply drops the hit without any warning or error and the hit just doesn’t get sent across.

The warning when the payload size is exceeded can be observed installing and running the Google Analytics Debugger browser extension as:

ga-maximum-payload-size

This warning means that the hit was aborted due to exceeding the 8192 length of the payload.

Note: Using Measurement Protocol to directly send data to Google Analytics, this size limitation applies to the POST request body. If the data is sent with a GET request, the maximum size of the entire /collect URL is 8000 bytes.


This usecase

There must have some changes in your program or within the AUT (Application Under Test) and as a result of those changes the payload sent to in the form of a JavaScript or an AJAX call to Google Analytics have exceeded 8192 bytes.

One possible reason may be the version incompatibility between the ChromeDriver and browser.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thanks for the comment. I should have been clearer. I know for a fact that a version that existed on the first is breaking now. I have also clarified that the headless argument specifically is when it's breaking. If I removed the headless argument it will work correctly. Do you have any idea what happens behind the scenes when it's running headless that would cause this specific error? – user3802799 Nov 12 '21 at 14:51
  • Btw, it wasn't a comment but a well researched answer :) – undetected Selenium Nov 12 '21 at 15:39