Since the code snippet does not have any comments indicating the source or reason for its inclusion, can we add <!--- Crazy Egg -->

On sites with many 3rd party snippets, it's always nice to know which one comes from where.

Comments

jcmiller09’s picture

Issue summary: View changes

oops, html comment! duh!

michelle’s picture

Issue summary: View changes

I was going to give this a whirl but it's not as simple as just adding in some comments. This is the relevant code:

$script = '
      setTimeout(function(){var a=document.createElement("script");
      var b=document.getElementsByTagName(\'script\')[0];
      a.src=document.location.protocol+"//' . $script_host . '/' . $account_path . '"+Math.floor(new Date().getTime()/3600000);
      a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 1);
      ';

    drupal_add_js($script, array('scope' => $js_scope, 'type' => 'inline'));

I asked on our work Slack and drupal_add_js doesn't let you put HTML comments in there. https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func... was suggested as a way to get it in there but that's more complicated than I'm able to get into right now. If anyone would like to make a patch, feel free. :)

kyletaylored’s picture

I have a patch in mind, but part of it depends on which of the "Page specific script loading" issues are committed.

crazyegg’s picture

Status: Active » Closed (outdated)

This is not needed anymore after the last update of the tracking script. Now it's a simple script tag with specific URL:

  <script src="//script.crazyegg.com/pages/scripts/0011/1111.js" async></script>

We don't want to add extra HTML comment as the source of the script is clear from this code now. Thank you all!