WordPress

  1. Install the Insert Headers and Footers plugin.
  2. Go to Settings > Header and Footer Scripts.
  3. Paste the code snippet into Scripts in the header textbox.
  4. Click Save Settings.

Alternative Method

  1. Navigate to Appearance > Theme Editor
  2. Click the Theme Header (header.php) file on the right-hand side below the Theme Files section.
  3. Paste the code snippet before the closing </head> tag.
  4. Click Update File