Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Delay link activation should not interfere with anchor and javascript links

Avatar

Avatar
Shape 1
Level 2
makbeta
Level 2

Likes

7 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Shape 1
Give Back 3
Give Back
Boost 5
Boost 3
View profile

Avatar
Shape 1
Level 2
makbeta
Level 2

Likes

7 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Shape 1
Give Back 3
Give Back
Boost 5
Boost 3
View profile
makbeta
Level 2

28-06-2018

In DTM the delay link activation breaks the JS-based links and in some instances anchor links functionality.

The request is to either:

1. Have an option to disable the delay link activation on links that are pure anchors, contain the URL of the existing page + an anchor, or contain javascript commands.

2. Revise the functionality of delay activation so that the delay just delays the activation of the link, not stops it and then takes user to that URL.

Including a sample code that successfully can achive both of these requests:

/**  * The functions executes for x milliseconds.  * @param  {Integer} ms  Number of milliseconds the function should run.  * @return  */ export default function waitMilliseconds(ms) {   var start = new Date().getTime();   var end = start;   while(end < start + ms) {     end = new Date().getTime();   } } /**  * Delays the links from moving forward on click by 1 second  * to allow the data to go into analytics successfully without the delays.  */ export default function handleInternalLinkClicks() {   let $body = $('body');    $body.on('click', 'a', function (event) {     var $link = $(event.currentTarget);     var currentUrl = window.location.href.split('#')[0];     var linkDestination = $link.attr('href');      // Delay the click on the pages that redirect us so the analytics has time to capture the data,     // ignore current page anchors.     if (linkDestination.indexOf('#') !== 0 &&          linkDestination.replace(currentUrl, '').indexOf('#') !== 0 &&         linkDestination.indexOf('javascript:') !== '0') {       waitMilliseconds(1000);     }   }); }
1 Comment

Avatar

Avatar
Give Back 5
Level 3
michael-au
Level 3

Likes

31 likes

Total Posts

22 posts

Correct reply

1 solution
Top badges earned
Give Back 5
Shape 1
Ignite 1
Give Back 3
Give Back
View profile

Avatar
Give Back 5
Level 3
michael-au
Level 3

Likes

31 likes

Total Posts

22 posts

Correct reply

1 solution
Top badges earned
Give Back 5
Shape 1
Ignite 1
Give Back 3
Give Back
View profile
michael-au
Level 3

17-06-2019

I always run into the issues with the delay link function, especially where JavaScript is used to deliver one URL on mobile devices and a pop-up on desktop. Usually with delay link active it will send the user to the mobile URL instead of the light-box popup on the desktop experience.