Introduction

This is the first of three tracking articles:

  1. How to Add Google Tag Manager (this article).
  2. How to Record Conversions Using GTM.
  3. Attribution and Conversion Tracking.

Note: this setup requires an advanced understanding of analytics and conversion tracking.

Background

  • Google Analytics 4 (GA4) records visits, UTM parameters, session duration and referral traffic on EnrolHQ pages.
  • Google Tag Manager (GTM) holds all tracking tags (GA4, Meta Pixel, Google Ads and others) in one container. Once GTM is added to EnrolHQ, the school's agency manages every tag in GTM without needing access to EnrolHQ.

Linking GTM Manager (GTM)

  1. Create a Google Tag Manager account at tagmanager.google.com, if the school doesn't have one. GTM issues a container ID in the format GTM-XXXXXXXXXX.
  2. Go to Settings > Custom Scripts > HTML Custom Page Head Code.
  3. Paste the embed script below, replacing GTM-XXXXXXXXXX (it appears twice) with the school's container ID.
  4. Click Save.
<!-- 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=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXXXXX');
<!-- End Google Tag Manager -->
 
function enrolHQInitAlways() {
  $(window).on('load', function() {
    $('body').prepend("<noscript><iframe src='https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXXXXX' height='0' width='0' style='display:none;visibility:hidden'></iframe></noscript>");
  });
}
</script>

Popular tags to add in GTM

Important: if the EnrolHQ site sits on a different domain from the school website, set up GA4 cross-domain measurement between the two. Without it, GA4 credits enquiries to the school website as a referral instead of the original campaign. See Attribution and Conversion Tracking.

Installing the Meta Pixel via GTM

  1. Log in to Google Tag Manager.
  2. Select the website's container and click Add a new tag.
  3. Click Custom HTML and name the tag.
  4. Go to Meta Events Manager and select Add event.
  5. Select From a new website.
  6. Select Install code manually.
  7. Select Copy code to copy the full pixel base code.
  8. Return to GTM and paste the code into the HTML field.
  9. Open the Advanced settings drop-down and select Once per page under Tag firing options.
  10. Under Fire on, select All pages.
  11. Click Create tag.

EnrolHQ tracking hooks

EnrolHQ calls a named JavaScript function (a hook) on specific pages and after specific actions. enrolHQInitAlways() runs on every page. The others run only where listed.

Page or action EnrolHQ hook
Page loads
All pages enrolHQInitAlways()
Enquiry page enrolHQInitEnquiry()
Register your interest page enrolHQInitRegisterInterest()
All event pages enrolHQInitEvent()
Event list enrolHQInitEventList()
Event details enrolHQInitEventDetails()
Enrolment (application) page enrolHQInitEnrolment()
Scholarship/EOI page enrolHQInitEOI()
Enrolment Dashboard enrolHQInitParentDashboard()
Success events
Enquiry submitted enrolHQOnEnquirySubmitSuccess()
Tour/event booking confirmed enrolHQOnBookingConfirmation()
Application submitted enrolHQOnEnrolmentSubmitSuccess()
Scholarship/EOI submitted enrolHQOnEOISubmitSuccess()
Custom Form submitted enrolHQOnCustomFormSubmitSuccess()
Payment success (application fee or offer acceptance) enrolHQInitPaymentSuccess()

The payload, recommended event name and Meta event for each success hook are in Attribution and Conversion Tracking.

Next steps

  1. Set up conversion triggers and tags in How to Record Conversions Using GTM.
  2. Connect campaigns to enrolment outcomes and track accepted offers in Attribution and Conversion Tracking.

Last updated: 1 October 2026