How to setup Google Analytics using Google Tag Manager

Google Tag Manager is a free tool that makes it easy to add/update website tracking snippets such as conversion tracking, site analytics, remarketing, etc. without the need to edit the website source code. This is perfect for when you have advanced tracking needs or are working with a third party specialist that will need to add/edit tracking snippets on your site. 

RealtyNinja integrated with Google Analytics without requiring Google Tag Manager, so there is no need to use GTM unless you have a specific advanced need to do so.

Here are the steps to setup GTM on your own

Step 1: Go to Google Tag Manager website and click Sign in at the top right and sign into your google account

Step 2: Click "Create Account"

Step 3: Enter your new account details as well as initial Container Setup and then click Create

Step 4: Read the "Terms of Service Agreement" that pops up, and then click "Yes" at the top right

Step 5: Once you have agreed to the terms it will bring you to the next step which will show you 2 code snippets that you have to add to your RealtyNinja website. You need to copy each snippet and put it into the custom code settings on your site (see next step)

Step 6: In a new browser tab, login to the backend of your RealtyNinja website (, then click Settings from the top right, then click "Custom Code" . Once you are in there you need to add the first snippet shown above to the Custom Header Code field and the second snippet to your Custom Body Code field.

Step 7: Return to your browser tab with the Google Tag Manager page open and click Ok to close the code snippets. You now have to click "Add a new tag"

Step 8: On the next screen you should add a descriptive label and then click the add new tag icon to get started on your tag setup

Step 9: Select the GA4 tag type

Step 10: Make sure you have your GA4 Measurement ID from your GA4 account which should look like this (this screenshot is from Google Analytics which you can open in a new tab to get your measurement ID)

Step 11: Enter your GA4 measurement ID (which you got from Google Analytics) and make sure the "Send a Page View" option is checked. (Note: you need to have a GA4 account created to get your measurement ID)

Step 12: Now click the New Trigger icon to create the trigger

Step 13: Choose "All Pages"

Step 14: Now click Save in the top right corner

Step 15: Give your tag a descriptive name and click Save again

Step 16: Now you need to submit your changes by click Submit in the top right corner

Step 17: Enter the same title as you used before and click Publish

At this point, you have completed the setup of GA4 being loaded via Google Tag Manager

You have completed the setup of GA4 being loaded via Google Tag Manager. Below you will find instructions on how to enabled lead tracking when using GTM to load GA4.

How to setup lead tracking when GA4 is being loaded via Google Tag Manager

For lead form tracking to work properly when GA4 is loaded via Google Tag Manager, you will have to complete some additional configuration by setting up a new trigger, variable and tag to ensure the required lead data is being pushed from GTM to GA4.

Step 1: First you need to create a new trigger

Step 2: Give the trigger a name and begin setup

Step 3: Choose Custom Event as the trigger type

Step 4: Enter lead_form as the event name and click Save

Step 5: Now you need to create a new variable

Step 6: Give the variable a name and enter the setup

Step 7: Choose Data Layer Variable as the variable type

Step 8: Enter page_url as the Data Layer Variable Name and click save

Step 9: Now you need to create a new Tag

Step 10: Give the tag a name and enter setup

Step 11: Choose Google Analytics: GA4 Event as the Tag Type

Step 12: Choose your existing GA4 tag from the list, enter lead_form as the Event Name, enter page_url as the Parameter Name and then choose Data Layer Variable - page_url by click the + beside the value field. Then click Save

Step 13: Scroll down and enter the triggering setup

Step 14: Choose Custom Event - lead_form

Step 15: Save your new tag setup

Step 16: Submit your changes

Step 17: Add a note describing what you just did and Publish your changes

After 24 - 48 hours you should start to see lead form event data in your GA4 reports. Here is a help doc that explains how to view this data in GA4.

Still need help? Contact Us Contact Us