Using a PHP Code snippet to insert a Google Tag

Elementor 3.17 Update Broke My Forms — Here’s the Fix

Everything looks fine for about twelve seconds. Then the contact forms stop submitting. No error message. No console warning. Just… ...

Read More

My WordPress Site Got Hacked (Not My Fault — wp2shell Did It)

Someone just exploited a hole in WordPress core that lets them take over your server without logging in. Here's what ...

Read More

Elementor Update Just Broke My Site — Here’s How I Sorted It

Updated Elementor and your site broke? I walk through the actual fixes that worked when it happened to a client ...

Read More

How To Make A Vertical 3D Gallery Slider

So if you follow along in the video, I refer to this blog post for you to enter code at ...

Read More
Showing Slide 1 of 5

In this video I created on YouTube (https://www.youtube.com/watch?v=BX-rrmJhUgU), I showed 5 different methods how to install the Google Tag into your WordPress website.

One of which is using a piece of PHP Code to install it directly into your site.

Unfortunately, YouTube didn’t allow me to paste the code into the description as it doesn’t allow the symbol < or > in the description so I made this blog post to paste the example code for anyone who might need the code example.

Without further ado !

//Add Google Tag To my Website
Function my_google_tag_code(){ ?>


/* Put you Google Tag Here !! */


<?php
}
Add_action ( ‘wp_head’ , ’my_google_tag_code’ , 10 );

Enjoy!!