Skip to content

Instantly share code, notes, and snippets.

View jordygrunn's full-sized avatar
🚀

Jordy Bakker jordygrunn

🚀
View GitHub Profile
@jordygrunn
jordygrunn / add-gtm-wp.php
Created September 1, 2022 11:41 — forked from jsn789/add-gtm-wp.php
Add Google Tag Manager through functions.php in WordPress
/* Add Google Tag Manager javascript code as close to
the opening <head> tag as possible
=====================================================*/
function add_gtm_head(){
?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=