New JS file vs Included within Embed Code

Avatar

Avatar
Validate 50
Level 8
SarahEOwen
Level 8

Likes

269 likes

Total Posts

408 posts

Correct reply

17 solutions
Top badges earned
Validate 50
Validate 25
Validate 10
Validate 1
Ignite 1
View profile

Avatar
Validate 50
Level 8
SarahEOwen
Level 8

Likes

269 likes

Total Posts

408 posts

Correct reply

17 solutions
Top badges earned
Validate 50
Validate 25
Validate 10
Validate 1
Ignite 1
View profile
SarahEOwen
Level 8

05-09-2017

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

1293005_pastedImage_0.png

Screen Shot 2 :: Launch Embed Code

1293008_pastedImage_3.png

Screen Shot 3 :: Other JS files injected by Launch

1293010_pastedImage_4.png

Thanks -

Sarah

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Employee
Aaronius9er9er9
Employee

Likes

34 likes

Total Posts

44 posts

Correct reply

16 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile

Avatar
Boost 5
Employee
Aaronius9er9er9
Employee

Likes

34 likes

Total Posts

44 posts

Correct reply

16 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile
Aaronius9er9er9
Employee

08-09-2017

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.

Answers (2)

Answers (2)

Avatar

Avatar
Contributor
Employee
thebenrobb
Employee

Likes

145 likes

Total Posts

318 posts

Correct reply

83 solutions
Top badges earned
Contributor
Seeker
Shape 1
Give Back 3
Give Back
View profile

Avatar
Contributor
Employee
thebenrobb
Employee

Likes

145 likes

Total Posts

318 posts

Correct reply

83 solutions
Top badges earned
Contributor
Seeker
Shape 1
Give Back 3
Give Back
View profile
thebenrobb
Employee

07-09-2017

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.

Avatar

Avatar
Validate 50
Level 8
SarahEOwen
Level 8

Likes

269 likes

Total Posts

408 posts

Correct reply

17 solutions
Top badges earned
Validate 50
Validate 25
Validate 10
Validate 1
Ignite 1
View profile

Avatar
Validate 50
Level 8
SarahEOwen
Level 8

Likes

269 likes

Total Posts

408 posts

Correct reply

17 solutions
Top badges earned
Validate 50
Validate 25
Validate 10
Validate 1
Ignite 1
View profile
SarahEOwen
Level 8

08-09-2017

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 -

Sarah