Skip to content

Page feedback: support for Google Analytics 4 (GA4) #1302

@chalin

Description

@chalin

Universal Analytics (UA) is deprecated. For details, see #1096. Here's some of the code associated with the page feedback feature:

const sendFeedback = (value) => {
if (typeof ga !== 'function') return;
const args = {
command: 'send',
hitType: 'event',
category: 'Helpful',
action: 'click',
label: window.location.pathname,
value: value
};
ga(args.command, args.hitType, args.category, args.action, args.label, args.value);
};
yesButton.addEventListener('click', () => {
yesResponse.classList.add('feedback--response__visible');
disableButtons();
sendFeedback(1);
});

This still uses the analytics.js library's ga() function. Note that this code is incompatible with GA4 because of the library that is used and the event name, as is explained below.

Tasks


Notes:

/cc @caniszczyk @nate-double-u

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions