Skip to content

Commit b6b942c

Browse files
Zach LasiukZach Lasiuk
authored andcommitted
adding analytics to share & CTAs on next steps
1 parent 931a19c commit b6b942c

File tree

2 files changed

+62
-27
lines changed

2 files changed

+62
-27
lines changed

themes/arm-design-system-hugo-theme/layouts/partials/learning-paths/next-steps.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,44 +55,44 @@
5555
<h2>Share</h2>
5656
<p>Share what you've learned.</p>
5757
<div class="social-sharing">
58-
<div class="social-icons">
59-
<a id="linkedin-link"
58+
<div id="social-share-icon-div" class="social-icons">
59+
<a id="linkedin-link" class="share-button" name="LinkedIn"
6060
title="Share via LinkedIn">
6161
<svg class="share-icon">
6262
<use xlink:href="/img/social-share/all-square-social-icons.svg#icon-linkedin"></use>
6363
</svg>
6464
</a>
6565

66-
<a id="twitter-link"
66+
<a id="twitter-link" class="share-button" name="Twitter"
6767
title="Share via X">
6868
<svg class="share-icon">
6969
<use xlink:href="/img/social-share/all-square-social-icons.svg#icon-twitter"></use>
7070
</svg>
7171
</a>
7272

73-
<a id="bluesky-link"
73+
<a id="bluesky-link" class="share-button" name="Bluesky"
7474
title="Share via Bluesky">
7575
<svg class="share-icon">
7676
<use xlink:href="/img/social-share/all-square-social-icons.svg#icon-bluesky"></use>
7777
</svg>
7878
</a>
7979

80-
<a id="facebook-link"
80+
<a id="facebook-link" class="share-button" name="Facebook"
8181
title="Share via Facebook">
8282
<svg class="share-icon">
8383
<use xlink:href="/img/social-share/all-square-social-icons.svg#icon-facebook"></use>
8484
</svg>
8585
</a>
8686

87-
<a id="email-link"
87+
<a id="email-link" class="share-button" name="Email"
8888
title="Share via email">
8989
<svg class="share-icon">
9090
<use xlink:href="/img/social-share/all-square-social-icons.svg#icon-mail"></use>
9191
</svg>
9292
</a>
9393

9494

95-
<a id="copy-link"
95+
<a id="copy-link" class="share-button" name="Copied"
9696
title="Copy link to Learning Path">
9797
<svg class="share-icon">
9898
<use xlink:href="/img/social-share/all-square-social-icons.svg#icon-link"></use>
@@ -244,7 +244,7 @@ <h4>Read related resources</h4>
244244
<div id="arm-dev-program-div" class="content-box">
245245
<h4>Talk with Arm Experts</h4>
246246
<p>Join the Arm Developer Program to share ideas, ask questions, and explore solutions with the support of the developer community.</p>
247-
<ads-cta-button id="join-dev-program" level="primary" sr-label="primary button">Join now</ads-cta-button>
247+
<ads-cta-button id="join-dev-program" level="primary" sr-label="primary button" class="next-step-cta" name="DevProgram">Join now</ads-cta-button>
248248
<script>
249249
document.getElementById("join-dev-program").onclick = function () {
250250
window.open("https://www.arm.com/resources/developer-program?#register","_blank");
@@ -253,7 +253,7 @@ <h4>Talk with Arm Experts</h4>
253253
</div>
254254

255255

256-
<div id="explore-tags-div" class="content-box">
256+
<div id="event-div" class="content-box">
257257
{{ $csv := resources.Get "events.csv" }}
258258
{{ $csv_content := $csv | transform.Unmarshal (dict "delimiter" ",") }}
259259

@@ -308,7 +308,7 @@ <h4>Attend {{index $event 0}}</h4>
308308
<p class="next-steps-subtitle">{{ $formatted_dates }}</p>
309309

310310
<p>{{index $event 7}}</p>
311-
<ads-cta-button id="event-cta" level="secondary">Event sign up</ads-cta-button>
311+
<ads-cta-button id="event-cta" level="secondary" class="next-step-cta" name="Event" data-event-name="{{index $event 0}}">Event sign up</ads-cta-button>
312312
<script>
313313
document.getElementById("event-cta").onclick = function () {
314314
window.open("{{index $event 8}}","_blank");
@@ -319,7 +319,7 @@ <h4>Attend {{index $event 0}}</h4>
319319
<h4>Learn more on Arm Developer</h4>
320320

321321
<p>Visit Developer.arm.com to continue your learning journey.</p>
322-
<ads-cta-button id="dev-cta" level="secondary">Developer.arm.com</ads-cta-button>
322+
<ads-cta-button id="dev-cta" level="secondary" class="next-step-cta" name="Developer.arm.com">Developer.arm.com</ads-cta-button>
323323
<script>
324324
document.getElementById("dev-cta").onclick = function () {
325325
window.open("https://developer.arm.com","_blank");

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

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,11 @@ function attachPageFindSearchTracker() {
279279
else if ( ( (depth_of_path == 4) | (depth_of_path == 5) ) & (current_path.includes('/learning-paths/')) ) {
280280
/* Assign to the following components:
281281
0. Onload detection
282-
1. Tags (only for intro and next step pages)
283-
2. Review ('check answer' button)
284-
2.5. Review (if all correct, add trigger for analytics somehow)
285-
3. Feedback (on Next Steps page)
282+
1. Tags (on Intro page)
283+
2. Feedback (on Next Steps page)
284+
3. Share (on Next Steps page)
285+
4. CTAs (on Next Steps page)
286+
5. Further Reading links (on Next Steps page)
286287
*/
287288

288289

@@ -351,7 +352,9 @@ function attachPageFindSearchTracker() {
351352
});
352353
}
353354

355+
// REMOVED NOW THAT REVIEW PAGE IS REMOVED. SAFE TO TAKE OUT.
354356
// 2) Review check answer btn and answers
357+
/*
355358
let check_answer_btn = document.getElementById('check-answer-btn');
356359
if (check_answer_btn) {
357360
// check answer button
@@ -389,9 +392,10 @@ function attachPageFindSearchTracker() {
389392
});
390393
});
391394
}
395+
*/
392396

393397

394-
// 3) Feedback on Next Steps page
398+
// 2) Feedback on Next Steps page
395399
// trackStarRating
396400
let stars = document.querySelectorAll('input[name=rating]');
397401
for (let star of stars) {
@@ -407,7 +411,47 @@ function attachPageFindSearchTracker() {
407411
trackChoiceFeedback(feedback);
408412
});
409413
}
414+
415+
// 3) Share on Next Steps page
416+
let share_a = document.getElementsByClassName('share-button');
417+
for (let share_link of share_a) {
418+
share_link.addEventListener("click", () => {
419+
_satellite.track('content-interaction', {
420+
'data-track-type' : 'learning-path-next-steps',
421+
'data-track-location' : 'share',
422+
'data-track-name' : share_link.getAttribute('name') // will be 'LinkedIn' or 'Facebook' or 'Email' or similar.
423+
});
424+
});
425+
}
426+
427+
// 4) CTAs on Next Steps page
428+
let cta_links = document.querySelectorAll('.next-step-cta');
429+
for (let cta of cta_links) {
430+
console.log('ctalink',cta);
431+
cta.addEventListener("click", () => {
432+
_satellite.track('content-interaction', {
433+
'data-track-type' : 'learning-path-next-steps',
434+
'data-track-location' : cta.getAttribute('name'), // either 'Event', 'DevProg', or 'Developer.arm.com'
435+
'data-track-name' : cta.getAttribute('data-event-name') // if Event, gives event name, otherwise, null.
436+
});
437+
})
438+
}
439+
440+
// 5) Further Reading links on Next Steps page
441+
let further_reading_links = document.querySelectorAll('#further-reading-div a');
442+
for (let link of further_reading_links) {
443+
link.addEventListener("click", () => {
444+
_satellite.track('content-interaction', {
445+
'data-track-type' : 'learning-path-next-steps',
446+
'data-track-location' : 'metadata',
447+
'data-track-name' : 'further-reading-link'
448+
});
449+
});
450+
}
451+
452+
410453
// metadata marking for similar learning paths, further reading, next learning path.
454+
/* All obsolete in new design
411455
let next_learning_path_link = document.getElementById('next-learning-path');
412456
if (next_learning_path_link) {
413457
next_learning_path_link.addEventListener("click", () => {
@@ -419,7 +463,6 @@ function attachPageFindSearchTracker() {
419463
});
420464
}
421465
422-
423466
let similar_lp_links = document.querySelectorAll('#similar-lp-div a');
424467
for (let link of similar_lp_links) {
425468
link.addEventListener("click", () => {
@@ -430,16 +473,7 @@ function attachPageFindSearchTracker() {
430473
});
431474
});
432475
}
433-
let further_reading_links = document.querySelectorAll('#further-reading-div a');
434-
for (let link of further_reading_links) {
435-
link.addEventListener("click", () => {
436-
_satellite.track('content-interaction', {
437-
'data-track-type' : 'learning-path-next-steps',
438-
'data-track-location' : 'metadata',
439-
'data-track-name' : 'further-reading-link'
440-
});
441-
});
442-
}
476+
443477
let explore_tag_links = document.querySelectorAll('#explore-tags-div ads-tag');
444478
for (let link of explore_tag_links) {
445479
link.addEventListener("click", () => {
@@ -450,6 +484,7 @@ function attachPageFindSearchTracker() {
450484
});
451485
});
452486
}
487+
*/
453488

454489

455490
// 4a) Navitaion from navbar

0 commit comments

Comments
 (0)