Adding Google Tag Manager (GTM) to EnrolHQ lets the school collect analytics, such as page views and form conversions, across every EnrolHQ page.
Introduction
This is the first of three tracking articles:
- How to Add Google Tag Manager (this article).
- How to Record Conversions Using GTM.
- 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)
- 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.
- Go to Settings > Custom Scripts > HTML Custom Page Head Code.
- Paste the embed script below, replacing GTM-XXXXXXXXXX (it appears twice) with the school's container ID.
- 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
- Google Analytics 4: tracks visitors to EnrolHQ pages. Set it up at analytics.google.com and link it inside GTM.
- Meta Pixel: tracks Facebook and Instagram advertising. See the steps below.
- Google Ads: tracks Google advertising. See Google's Google Ads conversion tracking guide.
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
- Log in to Google Tag Manager.
- Select the website's container and click Add a new tag.
- Click Custom HTML and name the tag.
- Go to Meta Events Manager and select Add event.
- Select From a new website.
- Select Install code manually.
- Select Copy code to copy the full pixel base code.
- Return to GTM and paste the code into the HTML field.
- Open the Advanced settings drop-down and select Once per page under Tag firing options.
- Under Fire on, select All pages.
- 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
- Set up conversion triggers and tags in How to Record Conversions Using GTM.
- Connect campaigns to enrolment outcomes and track accepted offers in Attribution and Conversion Tracking.
Last updated: 1 October 2026