Refactor: no need to pass through the ahoy event name dynamically. (#18498)
* refactor: the name does not need to be passed through dynamically * refactor: the name does not need to be passed through dynamically * chore: remove name from the js doc
This commit is contained in:
parent
c57acc25ea
commit
b6b9087bfb
4 changed files with 9 additions and 21 deletions
|
|
@ -160,5 +160,5 @@ targetNode && embedGists(targetNode);
|
|||
|
||||
initializeUserSubscriptionLiquidTagContent();
|
||||
// Temporary Ahoy Stats for comment section clicks on controls
|
||||
trackCommentClicks('comments', 'Comment section click');
|
||||
trackCommentClicks('comments');
|
||||
trackCommentsSectionDisplayed();
|
||||
|
|
|
|||
|
|
@ -125,12 +125,5 @@ if (document.location.pathname === '/admin/creator_settings/new') {
|
|||
loadCreatorSettings();
|
||||
}
|
||||
|
||||
trackCreateAccountClicks(
|
||||
'authentication-hamburger-actions',
|
||||
'Clicked on Create Account',
|
||||
);
|
||||
|
||||
trackCreateAccountClicks(
|
||||
'authentication-top-nav-actions',
|
||||
'Clicked on Create Account',
|
||||
);
|
||||
trackCreateAccountClicks('authentication-hamburger-actions');
|
||||
trackCreateAccountClicks('authentication-top-nav-actions');
|
||||
|
|
|
|||
|
|
@ -129,8 +129,5 @@ InstantClick.on('change', () => {
|
|||
});
|
||||
InstantClick.init();
|
||||
|
||||
trackCreateAccountClicks('sidebar-wrapper-left', 'Clicked on Create Account');
|
||||
trackCreateAccountClicks(
|
||||
'authentication-feed-actions',
|
||||
'Clicked on Create Account',
|
||||
);
|
||||
trackCreateAccountClicks('sidebar-wrapper-left');
|
||||
trackCreateAccountClicks('authentication-feed-actions');
|
||||
|
|
|
|||
|
|
@ -4,16 +4,15 @@ import ahoy from 'ahoy.js';
|
|||
// * passed in element.
|
||||
// *
|
||||
// * @param {string} elementId A unique identifier to identify the element that is being tracked
|
||||
// * @param {string} name The name of the event
|
||||
// */
|
||||
export function trackCommentClicks(elementId, name) {
|
||||
export function trackCommentClicks(elementId) {
|
||||
document
|
||||
.getElementById(elementId)
|
||||
?.addEventListener('click', ({ target }) => {
|
||||
const relevantNode = getTrackingNode(target, '[data-tracking-name]');
|
||||
|
||||
if (relevantNode) {
|
||||
ahoy.track(name, {
|
||||
ahoy.track('Comment section click', {
|
||||
page: location.href,
|
||||
element: relevantNode.dataset?.trackingName,
|
||||
});
|
||||
|
|
@ -25,15 +24,14 @@ export function trackCommentClicks(elementId, name) {
|
|||
// * passed in element.
|
||||
// *
|
||||
// * @param {string} elementId A unique identifier to identify the element that is being tracked
|
||||
// * @param {string} name The name of the event
|
||||
// */
|
||||
export function trackCreateAccountClicks(elementId, name) {
|
||||
export function trackCreateAccountClicks(elementId) {
|
||||
document
|
||||
.getElementById(elementId)
|
||||
?.addEventListener('click', ({ target }) => {
|
||||
const relevantNode = getTrackingNode(target, '[data-tracking-id]');
|
||||
if (relevantNode) {
|
||||
ahoy.track(name, {
|
||||
ahoy.track('Clicked on Create Account', {
|
||||
version: 0.1,
|
||||
page: location.href,
|
||||
source: relevantNode.dataset?.trackingSource,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue