How to add tracking scripts from external sites?
You can add the JavaScript on the theme level. You added on template.php or any other template that you wish to appear the javascript.

An example is a little bit tricky because is all depend on how the theme is was created. But I can provide an example base on my theme.

I'm using a sub-theme base on Boostrap so on my page.tpl.php I would add the JS on the bottom. So your goal would be to find the footer region and add the JS below that.

&lt;?php

?&gt;
&lt;header id="navbar" role="banner" class="&lt;?php print $navbar_classes; ?&gt;"&gt;
  &lt;div class="container"&gt;
  &lt;div class="col-md-3"&gt;
&lt;/div&gt;
    &lt;div class="navbar-header"&gt;
      &lt;?php if ($logo): ?&gt;
      &lt;a class="logo navbar-btn pull-left" href="&lt;?php print $front_page; ?&gt;" title="&lt;?php print t('Home'); ?&gt;"&gt;
        &lt;img src="&lt;?php print $logo; ?&gt;" alt="&lt;?php print t('Home'); ?&gt;" /&gt;
      &lt;/a&gt;
      &lt;?php endif; ?&gt;

      &lt;?php if (!empty($site_name)): ?&gt;
      &lt;a class="name navbar-brand" href="&lt;?php print $front_page; ?&gt;" title="&lt;?php print t('Home'); ?&gt;"&gt;&lt;?php print $site_name; ?&gt;&lt;/a&gt;
      &lt;?php endif; ?&gt;

      &lt;!-- .btn-navbar is used as the toggle for collapsed navbar content --&gt;
      &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"&gt;
        &lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;
        &lt;span class="icon-bar"&gt;&lt;/span&gt;
        &lt;span class="icon-bar"&gt;&lt;/span&gt;
        &lt;span class="icon-bar"&gt;&lt;/span&gt;
      &lt;/button&gt;
    &lt;/div&gt;

    &lt;?php if (!empty($primary_nav) || !empty($secondary_nav) || !empty($page['navigation'])): ?&gt;
      &lt;div class="navbar-collapse collapse"&gt;
        &lt;nav role="navigation"&gt;
          &lt;?php if (!empty($primary_nav)): ?&gt;
            &lt;?php print render($primary_nav); ?&gt;
          &lt;?php endif; ?&gt;
          &lt;?php if (!empty($secondary_nav)): ?&gt;
            &lt;?php print render($secondary_nav); ?&gt;
          &lt;?php endif; ?&gt;
          &lt;?php if (!empty($page['navigation'])): ?&gt;
            &lt;?php print render($page['navigation']); ?&gt;
          &lt;?php endif; ?&gt;
        &lt;/nav&gt;
      &lt;/div&gt;
    &lt;?php endif; ?&gt;
  &lt;/div&gt;
&lt;/header&gt;

&lt;?php if ($page['Featured']): ?&gt;
  &lt;div class="BannerColor"&gt;
    &lt;?php print render ($page['Featured']); ?&gt;
  &lt;/div&gt; &lt;!-- /. Featured --&gt;
&lt;?php endif; ?&gt;

&lt;div class="main-container container"&gt;

  &lt;header role="banner" id="page-header"&gt;
    &lt;?php if (!empty($site_slogan)): ?&gt;
      &lt;p class="lead"&gt;&lt;?php print $site_slogan; ?&gt;&lt;/p&gt;
    &lt;?php endif; ?&gt;

    &lt;?php print render($page['header']); ?&gt;
  &lt;/header&gt; &lt;!-- /#page-header --&gt;

  &lt;div class="row"&gt;

    &lt;?php if (!empty($page['sidebar_first'])): ?&gt;
      &lt;aside class="col-sm-3" role="complementary"&gt;
        &lt;?php print render($page['sidebar_first']); ?&gt;
      &lt;/aside&gt;  &lt;!-- /#sidebar-first --&gt;
    &lt;?php endif; ?&gt;

    &lt;section&lt;?php print $content_column_class; ?&gt;&gt;
      &lt;?php if (!empty($page['highlighted'])): ?&gt;
        &lt;div class="highlighted jumbotron"&gt;&lt;?php print render($page['highlighted']); ?&gt;&lt;/div&gt;
      &lt;?php endif; ?&gt;
      &lt;?php if (!empty($breadcrumb)): print $breadcrumb; endif;?&gt;
      &lt;a id="main-content"&gt;&lt;/a&gt;
      &lt;?php print render($title_prefix); ?&gt;
      &lt;?php if (!empty($title)): ?&gt;
        &lt;h1 class="page-header"&gt;&lt;?php print $title; ?&gt;&lt;/h1&gt;
      &lt;?php endif; ?&gt;
      &lt;?php print render($title_suffix); ?&gt;
      &lt;?php print $messages; ?&gt;
      &lt;?php if (!empty($tabs)): ?&gt;
        &lt;?php print render($tabs); ?&gt;
      &lt;?php endif; ?&gt;
      &lt;?php if (!empty($page['help'])): ?&gt;
        &lt;?php print render($page['help']); ?&gt;
      &lt;?php endif; ?&gt;
      &lt;?php if (!empty($action_links)): ?&gt;
        &lt;ul class="action-links"&gt;&lt;?php print render($action_links); ?&gt;&lt;/ul&gt;
      &lt;?php endif; ?&gt;
      &lt;?php print render($page['content']); ?&gt;
    &lt;/section&gt;

    &lt;?php if (!empty($page['sidebar_second'])): ?&gt;
      &lt;aside class="col-sm-3" role="complementary"&gt;
        &lt;?php print render($page['sidebar_second']); ?&gt;
      &lt;/aside&gt;  &lt;!-- /#sidebar-second --&gt;
    &lt;?php endif; ?&gt;

  &lt;/div&gt;
&lt;/div&gt;
&lt;footer class="footer container"&gt;
  &lt;?php print render($page['footer']); ?&gt;
    /**
        Load Custom JS
    **/
  &lt;script type="text/javascript"&gt;llfrmid=123456&lt;/script&gt; 
 &lt;script type="text/javascript" src="https://formalyzer.com/formalyze_init.js"&gt;&lt;/script&gt; 
 &lt;script type="text/javascript" src="https://formalyzer.com/formalyze_call_secure.js"&gt;&lt;/script&gt;
&lt;/footer&gt;