3 Replies Latest reply on Sep 8, 2017 9:20 AM by SarahEOwen

    New JS file vs Included within Embed Code

    SarahEOwen Level 4

      Can we discuss when a piece of code will create its own js script versus when it will be combined within the Launch embed code?


      Here's a scenario we can use for this discussion:


      1. I enabled the Facebook extension

      2. I went to the Rules tab and opened my existing "All Pages - DOM Ready - Pixels" rule

      3. I scrolled down to the "Then" portion of the rule and clicked the + icon

      4. I selected the Facebook Pixel extension and the "Send Page View" action. I kept the default name of "Facebook Pixel - Send Page View" (see screen shot 1 below)

      5. I went through the process of getting the changes to Stage. Stage is test1.hmkb2c.com for me

      6. Looking at the Elements tab in Developers' Tools, I see that the FB pixel appears to be added to my Embed Code js (see screen shot 2 below)

      7. I expected that the FB pixel would have made another js file - just like the other 2 rules in the "All Pages - DOM Ready - Pixels" rule (see screen shot 3 below).


      I would just like to be educated on where to expect and look for rules


      Screen Shot 1 :: Added FB pixel to existing Rule


      Screen Shot 2 :: Launch Embed Code


      Screen Shot 3 :: Other JS files injected by Launch



      Thanks -


        • 1. Re: New JS file vs Included within Embed Code
          thebenrobb Adobe Employee

          I'm going to need Aaronius9er9er9er to weigh in here for the real answer.  I believe that any custom code blocks will show up as secondary .js files linked to the main .js file.  Also, any libraries that are referenced (appmeasurement.js, at.js, etc) will obviously come separately - though they aren't linked in the same way that the ones coming from Launch are.

          • 2. Re: New JS file vs Included within Embed Code
            Aaronius9er9er9er Adobe Employee

            Hi Sarah. What gets embedded in the library vs loaded as separate files is largely left up to the extension. In the case of Facebook, there's really two parts. One part is the extension "action" code that Launch runs when a rule is fired. The action code then calls, for example, fbq('track', 'PageView');. The logic behind the fbq function that actually sends the request to the server, etc. is loaded in dynamically as a separate file. If you search your network tab for fbevents on http://test1.hmkb2c.com/ you'll see that file being loaded in. In other words, the code that's embedded in the Launch library is basically just glue between Launch and the fbevents library that gets loaded in.


            Technically, Facebook could opt into embedding the fbevents.js code into the Launch library instead of loading it as a separate file. It's their choice.


            In the case of the Core extension's Custom Code action, the custom code is embedded in the Launch library if it pertains to a rule that has a Page Top or Page Bottom event, otherwise it's split into a separate file.

            • 3. Re: New JS file vs Included within Embed Code
              SarahEOwen Level 4

              Thank you so much, @thebenrobb and @Aaronius9er9er9er, for the replies. You both always provide answers that are understandable!


              I really appreciate you, @Aaronius9er9er9er, explaining the Facebook example - the last sentence the references glue really helped solidify the relationship for me. And thank you for calling out when the Core extension makes separate file vs including it in the embed code!


              Thanks -