07 Publish Custom Code | BCS 07 Publish Custom Code | BCSBCS

07 Publish Custom Code

Adobe Launch BCS 4 years ago (2019-11-28) 1162 Views 0 Comments

In this section, we will share how to publish custom code. This code cannot be implemented through Extensions. Suppose we are deploying the global tracking code of Google Analytics here, the code is as follows:

<span style="font-size: 12pt;"><!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-69988360-1"></script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-69988360-1');

Libraries are the JavaScript files that load on the page to do all of the work. This section is mainly to understand the Libraries deployment logic,  Library configuration is mainly through Extensions, Data Elements and Rules:

  • Extensions are basically apps or plugins that can be used to enhance your Launch experience,It can simplify code deployment and configuration.
  • Data Elements store the attributes you want to send to your marketing and advertising solutions, which  are mostly used in Adobe Launch rules, but can also be used in Extensions
  • Rules fire the requests to those solutions under the right conditions.

Here, we do not need to use Extensions and Data Elements, we only need to use Rules to implement the deployment of custom code.

Create New Rules

In the top navigation, click Rules and then click “Add Rule”:

07 Publish Custom Code

Then you will see such an interface. This is the rule setting interface. The role of the rule is to perform any operation when the conditions are met, similar to If … then …

07 Publish Custom Code


  • Name the Rule All Pages – Library Loaded . This naming convention indicates where and when the rule will fire, making it easier to identify and re-use as your Launch property matures.
  • IF – Determines when you want the rule to fire, if includes events and conditions, EVENTS are mandatory things that must occur before a rule will fire; CONDITIONS are options checks again the state of environments to further restrict the rule.
  • THEN – Determines what you want the rule to do, Only ACTIONS.


Under Events, click Add . The Event tells Launch when the rule should fire and can be many things, including a page load, a click, a custom JavaScript event, etc.07 Publish Custom Code

As the Event Type, select Library Loaded (Page Top) . Note that when you select the Event Type, Launch pre-populates a name for the event using your selection. Also note that the default order for the event is 50. Ordering is a powerful feature in Launch which gives you precise control over the sequence of actions when you have multiple rules that are triggered by the same event. You will use this feature later in the tutorial.The configured effect is as follows:

07 Publish Custom Code

Click the Keep Changes button.



Since this rule should fire on all pages, leave Conditions blank. Under Actions, click Add:

07 Publish Custom Code

Select Action Type > Custom Code , which at this point is the only option. Select HTML and Click </> Open Editor to open the code editor:
07 Publish Custom Code
A page will pop up and paste the code into it.
07 Publish Custom Code
On the Action configuration screen click Keep Changes and Click Save to save the rule. The final effect:
07 Publish Custom CodePlease refer to the publishing process: 06 Library Publishing and Testing

If you don't understand, You can leave a comment below.
Like (0)
Post my comment
Cancel comment
Expression Bold Strikethrough Center Italic

Hi, you need to fill in your nickname and email!

  • Nickname (required)
  • Email (required)
  • Website