Hi everyone,
I have worked with many tag management systems but I am new to Launch.
I am trying to capture the best approximation to page load time into an eVar and a numeric event. I have tried some traditional ways of solving it that have worked in other environments. However I am having a hard time to get it to work in Launch.
For example:
a) I am trying to capture a timestamp on "Library Loaded (Page Top)". I am using a Custom Code action step on the same rule that sends the page view beacon:
launchDataLayer.pageLoadStart = Date.now();
b) Then I am capturing another time stamp on "Window Loaded". Once again I am using a custom code on a separate rule firing on Window Loaded.
I am also storing the calculated value in the dataLayer objcet
launchDataLayer.pageLoadEnd = Date.now();
launchDataLayer.pageLoadTime = launchDataLayer.pageLoadEnd - launchDataLayer.pageLoadStart;
c) However when I try to read this value when setting the variables before sending the beacon, it doesn't have any value.
I am pretty sure I am missing something. What am I doing wrong? Is there a better and simple what to accomplish this with Launch?
Thank you in advance for your help!
Jose
Solved! Go to Solution.
Views
Replies
Total Likes
You may not be getting any data collected to your variables because of the timing that data elements are evaluated for SetVars.
Based on what you said here:
Adobe launch handles Data Elements in a very specific manner when they are referenced in the GUI (like a setVars action block or within the analytics extension 'Global Varables' section). So let's imagine the following scenario:
MyPage Rule
- Trigger: PageTop
- Actions:
- - Custom Code Action Block (gets a timestamp value and puts it in the dataLayer)
- - Analytics SetVars Action Block (sets eVar1 = %DataElementGetTimeFromDataLayer%)
- - Analytics Send Beacon Action Block
Actual Execution Order:
If you want the data element to be evaluated after that action block, you may want to use the setVars custom code area to set this variable, which gets run at the timing you were expecting.
Or, alternatively, you could move your "Custom Code that gets the timestamp" up into the 'Conditions' area, which means it will be fully executed before those data elements are runnning. (just remember to end your condition with a return true;)
Views
Replies
Total Likes
Are you using a ContextHub Data Element to read out this property? AFAIK these only get initialized when the script loads.
When and how are you sending the beacon? One option would be to use a direct call rule and provide the values as a payload:
_satellite.track('load-time', {loadStart: launchDataLayer.pageLoadStart, loadEnd: launchDataLayer.pageLoadEnd, loadTime: launchDataLayer.pageLoadTime})
and then in the custom code Set Variables action of your rule you have this object available as event.detail
Views
Replies
Total Likes
We use user-centric performance metrics, you can read here User-centric Performance Metrics | Web Fundamentals | Google Developers
This example code is for GA, it can be adapted to Adobe pretty easily.
You may not be getting any data collected to your variables because of the timing that data elements are evaluated for SetVars.
Based on what you said here:
Adobe launch handles Data Elements in a very specific manner when they are referenced in the GUI (like a setVars action block or within the analytics extension 'Global Varables' section). So let's imagine the following scenario:
MyPage Rule
- Trigger: PageTop
- Actions:
- - Custom Code Action Block (gets a timestamp value and puts it in the dataLayer)
- - Analytics SetVars Action Block (sets eVar1 = %DataElementGetTimeFromDataLayer%)
- - Analytics Send Beacon Action Block
Actual Execution Order:
If you want the data element to be evaluated after that action block, you may want to use the setVars custom code area to set this variable, which gets run at the timing you were expecting.
Or, alternatively, you could move your "Custom Code that gets the timestamp" up into the 'Conditions' area, which means it will be fully executed before those data elements are runnning. (just remember to end your condition with a return true;)
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies