April 27, 2020
Estimated Post Reading Time ~

How to include dynamic custom script to websites through Adobe Launch

Launch, by Adobe is a next-generation tag management system that unifies the client-side marketing ecosystem by empowering developers to build integrations on a robust, extensible platform that partners, clients, and the broader industry can build on and contribute to.

Adobe Launch is the upgraded version of Adobe’s Dynamic Tag Manager (DTM), Adobe’s Dynamic Tag Manager (DTM) will be replaced by Adobe Launch(It doesn’t mean the platform will be shut down anytime soon).

This post explains the approach to use Adobe Launch to include the dynamic scripts as part of Adobe Experience Manager(AEM) websites.

Log in to Adobe Launch and create new property- LAUNCH_CUSTOM_SCRIPT, specify the domain as localhost.local for localhost testing and Save the Property.



Define New Rule:


Configure the Event



Configure the Action


Define the script in Editor


var s = document.createElement("script");
s.innerHTML = "alert('Custom Script from GTM');"; // add the custom script content
//s.src="test.js";// specify the script file instead of script content
document.head.appendChild(s);

Adding multi-line script - example

s.innerHTML = "document.onreadystatechange = function(){ "+
"if(document.readyState=='loaded' || document.readyState=='complete') "+
"alert('test');"+
"}";







Publish the change to the Development environment:

Add New Library to apply the changes to Development Environment


Select the Environment value as Development


Add Specific Resource or All changed Resources to Library for Deployment to Development environment(to deploy the latest change to the Development environment, remove the current version from Library and add the latest version)


Select the Resource(CUSTOM_SCRIPT rule) Version(Latest) and Create New Revision and finally Save the Library.


Click on Apply Updates and Continue (this is required only for the first time)


Build the library for Development


Now the changes are deployed to Development Environment


To apply the new changes(latest pending changes) to the Development environment
Remove the current version from the Library(My case Revision 2)


Add the latest resource version and Click on Select&Create New Revision




Click on Save & Build for Development


Now the latest rule change is deployed to Development Environment

For testing the Property in the Development environment, install the Development script to the AEM(Adobe Experience Manager) website header.


(Multiple Development Environment can be added for testing)

Copy the script to clipboard


Add the script to the header page


Now the script is inserted into the website pages



Publish the changes to Stage and Prod environments:
Click on Submit for Approval on Library


Click on Submit


Click on Build for Stage


Now the changes are deployed to Stage

Click on Approve for Publishing to publish the changes to Production Environment


Click on Approve


Build & Publish to Production


Click on Publish


Now the changes are published to the Production environment.


Configure the Stage and Production environment scripts to corresponding AEM environments


Add New Library and follow the process explained above to send the additional changes to Development to Production Environments


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.