How to Add Custom JavaScript Code to Google Analytics Tracking

Do you want to add custom JavaScript code to your MonsterInsights Google Analytics Tracking?

If your WordPress theme has a setting or option where you can insert custom JavaScript into the header of your website, you can use that.

For users who don’t have this option readily available, you can use a plugin called Insert Header and Footers.

Follow this guide to learn how to insert JavaScript code through the Insert Header and Footers plugin.

Step 1: Log in to your WordPress dashboard and then install the Insert Header and Footers plugin.

Insert Headers and Footers Settings

You’ll see 2 boxes for adding header and footer code.

Step 2: Paste your JavaScript code into the Scripts in Header input box at the top and click the Save button.

That’s it! You’ve inserted custom JavaScript code to adjust your MonsterInsights and Google Analytics tracking.

Are you looking to set up custom dimensions in MonsterInsights and Google Analytics? Learn how to set up custom dimensions.