Hi,
We have an direct call identifier for link click and when link clicks hapeens there data layer is loading with few datapoints . which we can use and assign evars. the floow is working majority of the situvations but one senario rule is firing but unable get the data layer values. whats best way we can handly these timing issues to load data.
i have tried event lisners and setting up some delay it's worked but i am fine with these solution , so i am expection any other better recommendation which can deal with these issue and timing issues as well.
Views
Replies
Total Likes
Hi @MaheswarRe
where exactly are the data points coming from? From an asynchronous API?
If you know what to wait for, maybe you have to delay the execution of your rule a little.
You could for instance use a Promise in an action in the beginning of your list of actions.
For instance, this code waits for a window.gtag variable to be available until resolving and the next action run.
I guess you can easily adapt it to your needs/datapoints.
let checkGtag = new Promise((resolve, reject) => {
if (window.gtag) {
resolve('gtag loaded');
}
let intervalRuns = 0;
let interval = setInterval(() => {
if (!window.gtag && intervalRuns < 20) {
intervalRuns++;
} else {
clearInterval(interval);
if (!window.gtag) {
_satellite.logger.debug(">>> Gtag NOT loaded");
reject('gtag not found');
} else {
// gtag loaded
resolve('gtag loaded');
}
}
}, 100);
});
return checkGtag;
Views
Replies
Total Likes
Hi,
Without knowing your site or what is happening, it can be hard for us to make recommendations about what is happening or how to proceed.
I suspect that the one scenario is a timing issue.. something along the lines of, user clicks on a link, the devs send information to the data layer and you try to track based on this... but the page has already moved on to the next page (cancelling the tracking call and losing the data layer values).
This is why I hate event based data layers... they have too many actions that have to be performed in sequence and end up being inefficient because the site unloads the page before everything can be captured.
Yes, it's timing issue when user clicks on link dev passing data layer values , if i am adding event listners i am able to fetch but i am not intersted to use event lisner and delay setup apart from that is there way we can fetch those values
Views
Replies
Total Likes
I suppose it depends on what information you need.
For me, most of my clickable elements, I can get everything I need through my "Click" CSS selector and JS to extract information from the element... but all sites are different.
One solution I have done in the past (again, since I don't use event based data layers) is to have the developers add some additional data attributes onto the element.. so that with my click rule, I can pull the information from the attributes.
I can do the click, the data extraction and the tracking in a single place, as opposed to a multi-step setup that the event based data layer relies on (developer listens for the click, developer pushes info to data layer, Launch watches for the data layer update to get info and send data). Basically 1 step vs 3 steps.
Would you be willing to share a URL and what link you are having issues with, along with what information you need to collect? (you can send in a private message so you don't have to share it publicly)
Views
Replies
Total Likes
Is there any reason that your developers can't resolve the tracking problem for that one scenario?
Given your setup, I would personally avoid trying any workaround within Launch. The reason is that your setup has basically standardised to use Direct Calls already, and future-you or your successors will expect that to be appllied for all scenarios.
By introducing this special scenario that uses event callbacks, you're making maintenance troublesome and/or complicated, and that could lead to long-term maintenance and troubleshooting problems.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies