Expand my Community achievements bar.

SOLVED

web performance Issue with adobe launch web sdk

Avatar

Level 1

hi I am trying to add adobe launch script

https://assets.adobedtm.com/xxxxxxx/xxxxxxxxx/launch-xxxx.min.js

I have some query while adding this 

1. If I add this script in footer with async, try to track event from my component , before this script is loaded then there will be loss of events as of in ga we have datalayer where we push the events it gets tracked as sson as js is loaded, how can i achieve same behaviour as ga in omniture

2. Is there a way we can add batching in request 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

1. Add this script in the <head> of your page with async.

2. What are you batching? Can you elaborate on this question?

View solution in original post

11 Replies

Avatar

Community Advisor and Adobe Champion

May I ask why you are adding the Launch File in the footer (I mean, I understand that you are trying to add the script later in the page to avoid render blocking scripting, but the async should prevent that)? In the instructions Adobe says to add to the head... I really don't know what impacts adding that late in the page will cause... GTM is also supposed to be added to the head of a website... 

 

Just because the JS file is in the head, you can defer the actual tracking to later in the page execution... remember, the Launch file is the tag manager, it can be used to do more than just tracking events... so having it available as soon in your page as possible gives you much more freedom to control when things execute.

 

 

Are your developers pushing the GA DataLayer events manually? Rather than using GTM code to trigger the DataLayer changes... that is the only way I could see you getting away with not having GTM in the head.... If so, you could create your own custom Data Layer and try to do a similar behaviour.. it will require a good coder though.... 

 

Without really seeing the specifics of your implementation I really can only make high level suggestions... 

Avatar

Level 1

@Jennifer_Dungan  if we add async in head tag it will start executing script once it is downloaded and because of which it can block my rendering if thread is in between parsing the html, so i want once html rendering is complete then it should execute, which is basically achieved by adding defer, but since right now launch doesn't support defer, wanted to know is there any way i can achieve that my rendering process gets complete then this script gets executed

Avatar

Community Advisor

If you need your HTML to finish rendering first before a Rule runs, then in that Rule, use the Core > Window Loaded event. That event will trigger only when the browser has finished loading the window's document, including HTML, scripts, stylesheets and images, i.e. it is equivalent to window.onload().

Avatar

Community Advisor and Adobe Champion

Yes.. but all your Rule Triggers (like your clicks) need to be available for when users click on your elements.... if the JS hasn't loaded, you will get the bad behaviour you are talking about (i.e. people clicking on elements and not getting tracking).

 

Again, I ask... are you having your Developers triggering all you GTM events (rather than creating triggers in GTM)? Because if GTM is loaded in the footer, you should have the exact same issue there?

Avatar

Community Advisor and Adobe Champion

The JS should be loaded in the head so that it can listen for all the different events, as @yuhuisg said, you have absolute control over when the actual tracking is triggered.

 

Async should not block the actual rendering of your content.... which is why it's placed in the head according to the instructions... there are many ways to trigger the tracking... 

 

  • Window Loaded
  • DOM Ready
  • you can even have your developers code a custom event if you need it to be at a specific time in the execution (after your content is loaded, but before all the third party scripts finish)

Avatar

Level 1

@Jennifer_Dungan  when we add gtm scripts in our page that time we define data layer too, and when script is loaded then events already available in data layer is pushed to GA as window.datalayer = window.datalayer || [];   this way we do not loose any of our tracking.

But when we are trying to use analytics through adobe there is no as such defining satellite variable and storing events in that variable till launch is not loaded, so we basically have to wait for any event tracking till script is loaded and initialized then only will able to use _satellite method to track events

Avatar

Community Advisor

Take a look at the Adobe Client Data Layer: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/all-you-need-to-know-about...

It works similarly to GTM's dataLayer, including being able to trigger for any events that had been pushed into it prior to Launch's loading.

Avatar

Community Advisor and Adobe Champion

Right... @yuhuisg said, you can use Adobe's Data Layer, but IF you are using any of Launches triggers (like element clicked, or anything that would happen before the page is loaded) will still be lost because the code to detect those triggers hasn't yet been loaded. Unless you are getting your devs to do ALL detection, and pass all info to a data layer (that should work) but since no one else that I know of has implemented the script in the footer, you will have to do a lot of testing to make sure that this works as intended.

 

@yuhuisg and I (and any other advisors) will do our best to help you, but moving the script is non-standard and you may run into issues that we cannot help you with. Please try the suggestion of using Adobe's Data Layer.. I wish you luck

Avatar

Correct answer by
Community Advisor

1. Add this script in the <head> of your page with async.

2. What are you batching? Can you elaborate on this question?

Avatar

Level 1

wanted to batch events that are going for track on load, as for every track there will be api hit, so wanted to batch multiple track events and hit less api 

 

@yuhuisg 

Avatar

Community Advisor

Such batching is only available with the Mobile SDK for mobile apps. There's no such batching available with Web SDK.

Adobe charges you for the number of hits, which normally corresponds to the number of page views and custom links that you're tracking. So even with the Mobile SDK, Adobe still charges you for the actual number of hits in the batch, regardless of the number of times their endpoint gets hit.