I'm trying to streamline a bit of work within GA4 where I have a set of dimensions to create for a long list of GA4 properties. Navigating to the Custom definitions screen, I have a script I run in the dev tools console that is set up to simply click/type what I would typically do by hand.
However, after executing the code, the page doesn't recognize that the field was changed, and some kind of validation doesn't execute, so the save button remains disabled. Further, if I then click into the field, form field validation shows an error, but copy and pasting the same text resolves the issue.
Here's the relevant portion of the code I'm running:
document.querySelector('button.create-definition-button').click();
document.querySelector('definition-builder input.custom-name-control').value = dimensions[i].customName;
I've attempted to further emulate what I do by hand by trying any mix of the following types of things:
document.querySelector('definition-builder input.custom-name-control').click();
document.querySelector('definition-builder input.custom-name-control').blur();
document.querySelector('definition-builder input.custom-name-control').dispatchEvent(new Event('change'));
Unfortunately with no luck. Ideas?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/rvyiqQR
Comments
Post a Comment