From 256a9db7d3a83042c072901464d82bec6e6e3ee0 Mon Sep 17 00:00:00 2001 From: mlnkng Date: Thu, 28 Sep 2023 11:23:09 -0700 Subject: [PATCH] Fix GA4 tracking for fullwidth treeview. (#1606) --- js/fullWidthTreeView.js | 8 +++++++- plugins/arDominionB5Plugin/js/fullWidthTreeView.js | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/js/fullWidthTreeView.js b/js/fullWidthTreeView.js index f5c1e69207..0d13c71b17 100644 --- a/js/fullWidthTreeView.js +++ b/js/fullWidthTreeView.js @@ -187,6 +187,12 @@ // Insert new content into page $('#main-column h1').first().replaceWith($(response.find('#main-column h1').first())); + // Get new document title for G4 Tracking + var doctitle = $('#main-column h1').first(); + + // Extract the text content without HTML tags and set title + document.title = doctitle[0].textContent; + // Add empty breadcrumb section if current page has none, but response does if (!$('#main-column .breadcrumb').length && $(response.find('#main-column .breadcrumb').length)) { @@ -269,7 +275,7 @@ } }; - // On node open: remove tooltip after a node is selected, the + // On node open: remove tooltip after a node is selected, the // node is reloaded and the first tooltip is never removed var openNodeListener = function (e, data) { diff --git a/plugins/arDominionB5Plugin/js/fullWidthTreeView.js b/plugins/arDominionB5Plugin/js/fullWidthTreeView.js index 567a437b38..9ebaa60baf 100644 --- a/plugins/arDominionB5Plugin/js/fullWidthTreeView.js +++ b/plugins/arDominionB5Plugin/js/fullWidthTreeView.js @@ -288,6 +288,12 @@ .first() .replaceWith($(response.find("#main-column h1").first())); + // Get new document title for G4 Tracking + var doctitle = $('#main-column h1').first(); + + // Extract the text content without HTML tags and set title + document.title = doctitle[0].textContent; + // Add empty breadcrumb section if current page has none, but response does if ( !$("#breadcrumb").length &&