Skip to content

Commit d8cac1e

Browse files
authored
Merge pull request #1567 from zachlasiuk/main
TEMPLATE: Author analytics tracking enhanced.
2 parents 14fae61 + 968de64 commit d8cac1e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

themes/arm-design-system-hugo-theme/layouts/learning-paths/learningpathall.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
<!-- Title of _index.md always top left -->
3838
{{ with .Site.GetPage $thisdir}}
3939
<h6 id="learning-path-title" class="u-margin-top-1/2" style="font-size:1em; font-weight: normal;">{{ .Params.Title }}</h6>
40+
<!-- Author name hidden but availible for analytics -->
41+
<div hidden id="learning-path-author" data-author="{{.Params.author_primary}}"></div>
4042
{{ end }}
4143

4244

themes/arm-design-system-hugo-theme/static/js/anonymous-analytics.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,13 @@ function attachPageFindSearchTracker() {
292292
let lp_step = document.getElementById('learning-path-step-active').innerText.trim();
293293
let lp_step_num = document.getElementById('learning-path-step-active').getAttribute('data-step-num');
294294
let lp_category = current_path.split('/')[2];
295+
let lp_author = document.getElementById('learning-path-author').getAttribute('data-author').trim();
295296

296297
// specific to intro page only;
297298
if (document.getElementById('skill-level')) {
298299
let lp_skill_level = document.getElementById('skill-level').innerText.trim();
299300
let lp_reading_time = document.getElementById('reading-time').innerText.trim();
300301
let lp_last_updated = document.getElementById('last-updated').innerText.trim();
301-
let lp_author = document.getElementById('author').innerText.trim();
302302
let lp_tag_elements = document.querySelectorAll('#tags-for-content ads-tag');
303303
let lp_tags = ''
304304
for (let ele of lp_tag_elements) {
@@ -329,7 +329,8 @@ function attachPageFindSearchTracker() {
329329
learningPathName: lp_title,
330330
learningTabName: lp_step,
331331
pageNumber: "page " +lp_step_num,
332-
learningPathCategory: lp_category
332+
learningPathCategory: lp_category,
333+
learningPathAuthor: lp_author
333334
}
334335
};
335336
}

0 commit comments

Comments
 (0)