Our developers have indicated in several tests that conflicts have occasionally caused issues with the loading of the DTM header library, so that when the footer runs, it generated a JavaScript error due to the _satellite.pageBottom() function not being found.
Are there any circumstances where wrapping the pageBottom function in a try/catch might cause issues?
Solved! Go to Solution.
Hi ,
We have not observed any circumstances where wrapping the pageBottom function in a try/catch block caused any issue. We have also tested the same on our test environment and the results were positive.Please find below try/catch block script being used.
To verify that our dynamic tag management header library is loading properly on our site, we used the command _satellite.settings.notifications = true; in try block and If the code was not properly installed, we will get the reference error: _satellite is not defined and the same will caught by catch block and flag is set to 1 .
Ultimately the finally block runs and if flag is not 1 i.e. Header library is properly loaded, call the _satellite.pageBottom(); function.
<script> try{ _satellite.settings.notifications = true; } catch(err) { flag=1; console.log(err); } finally { if(flag!=1) { _satellite.pageBottom(); } else { alert("DTM Header Library not properly Loaded"); } } </script> </body> </html>
Please make sure to initialize the flag to 0 at the start of the head tag , like below :
<head> <script> var flag=0; </script> <script src="//assets.adobedtm.com/satelli4b6f12d-staging.js"></script>
Please let us know if you have any questions or queries.
Thanks & Regards
Parit Mittal
Hi ,
We have not observed any circumstances where wrapping the pageBottom function in a try/catch block caused any issue. We have also tested the same on our test environment and the results were positive.Please find below try/catch block script being used.
To verify that our dynamic tag management header library is loading properly on our site, we used the command _satellite.settings.notifications = true; in try block and If the code was not properly installed, we will get the reference error: _satellite is not defined and the same will caught by catch block and flag is set to 1 .
Ultimately the finally block runs and if flag is not 1 i.e. Header library is properly loaded, call the _satellite.pageBottom(); function.
<script> try{ _satellite.settings.notifications = true; } catch(err) { flag=1; console.log(err); } finally { if(flag!=1) { _satellite.pageBottom(); } else { alert("DTM Header Library not properly Loaded"); } } </script> </body> </html>
Please make sure to initialize the flag to 0 at the start of the head tag , like below :
<head> <script> var flag=0; </script> <script src="//assets.adobedtm.com/satelli4b6f12d-staging.js"></script>
Please let us know if you have any questions or queries.
Thanks & Regards
Parit Mittal
Views
Likes
Replies