javascripthtmlgoogle-analyticsmeta-tagscontent-experiments

Does it Make Sense to Insert the Google Content Experiements Tag after <meta> tags?


Google instructs us to put the Content-Experiments JavaScript immediately after the <head> tag.

Does it make sense to actually insert it a little later than that, such as after some key compatibility <meta> tags, like:

<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge;" />
  <!-- Other important tags? -->
  <!-- Google Analytics Content Experiment code -->
  ...

... or is it totally and absolutely best to put the JavaScript above all else?


Solution

  • I found a specific case where it is actually very important to place the Google Analytics Content Experiments stuff AFTER certain <meta> tags.

    I use a "dynamically triggered" Content Experiments, and thus, leave a great big JS block at the top. However, that block MUST come after <meta http-equiv="X-UA-Compatible" content="IE=edge" /> (or whatever IE version you like). The consequence of having Content-Exp after the <meta> tag is that IE will drop down to old-school corporate compatibility mode (IE7 behaviour) when navigating to websites that are incorrectly believed to be part of the Local Intranet zone.