Google Tag Manager (GTM) Integration Guide
Overview
The Optimus platform integrates with Google Tag Manager (GTM) to provide real-time analytics tracking throughout the borrower's loan application journey. GTM events are automatically fired at key milestones as the borrower progresses through the application, giving you full visibility into applicant behavior, drop-off points, and conversion metrics.
The platform supports three primary loan flows, each with its own set of application steps:
Purchase - Borrowers buying a new home
Refinance - Borrowers refinancing an existing mortgage
HELOC (Home Equity Line of Credit) - Borrowers accessing their home equity
All three flows share the same GTM event types and data payload structure, making it simple to build a unified analytics setup.
GTM Container Setup
Once your GTM Container ID (format: GTM-XXXXXXX) is provided to your account administrator, the Optimus platform automatically integrates with your GTM workspace.
Every application event is pushed directly to your GTM container's dataLayer.
Your container uses a namespaced dataLayer (e.g.,
{YourPrefix}DataLayer) to keep data cleanly isolated.Your company prefix is automatically derived from the initials of your company name (e.g., "Acme Lending" becomes prefix
AL).
No code installation is required on your end. The platform handles all GTM script loading, dataLayer management, and event firing automatically.
GTM Events
The platform fires six event types throughout every application lifecycle, regardless of loan type. Each event is pushed to your GTM dataLayer automatically.
Event Tag (in dataLayer) | Event Name | When It Fires |
| Pre-Qualification Started | When the borrower creates a new application and the first step loads |
| Step Started | Each time the borrower navigates to a new step |
| Step Completed | Each time the borrower successfully completes/submits a step |
| Pre-Qualification Completed | When Phase 1 (Pre-Qualification) is submitted |
| Application Started | When Phase 2 (Full Qualification) begins |
| Application Completed | When the full application is submitted |
Note: {prefix} is your company prefix (e.g., for a company named "Acme Lending", events appear as AL-step-completed).
These six events are identical across Purchase, Refinance, and HELOC flows. The step field tells you which specific step the borrower is on, and the loanPurpose field tells you which flow they are in.
Event Data Payload
Every GTM event push includes the following variables in the dataLayer. These are available for use in your GTM triggers, tags, and variables.
Variable | Type | Description | Example |
| string | The full event name including your company prefix |
|
| string | Your company name |
|
| string | The raw event type |
|
| string | The step identifier the borrower is on |
|
| string | Unique identifier of the primary borrower |
|
| string | Unique identifier of the loan application |
|
| string (optional) | The selected loan purpose |
|
| string (optional) | Sub-purpose for refinance or HELOC flows |
|
Sample Event - Purchase Flow
{
event: "AL-step-completed",
companyName: "Acme Lending",
step: "DownPayment",
borrowerId: "b8f3e2a1-4c5d-6e7f-8a9b-0c1d2e3f4a5b",
loanId: "a4d7c9e2-1b2c-3d4e-5f6a-7b8c9d0e1f2a",
loanPurpose: "Purchase"
}
Sample Event - Refinance Flow
{
event: "AL-step-completed",
companyName: "Acme Lending",
step: "CurrentMortgageBalance",
borrowerId: "b8f3e2a1-4c5d-6e7f-8a9b-0c1d2e3f4a5b",
loanId: "c5e8f1a3-2d4b-6c7e-9f0a-1b2c3d4e5f6a",
loanPurpose: "Refinance",
refinancePurpose: "LowerRate"
}
Sample Event - HELOC Flow
{
event: "AL-step-completed",
companyName: "Acme Lending",
step: "AdditionalLoanHelocHighBalance",
borrowerId: "b8f3e2a1-4c5d-6e7f-8a9b-0c1d2e3f4a5b",
loanId: "d6f9a2b4-3e5c-7d8f-0a1b-2c3d4e5f6a7b",
loanPurpose: "AdditionalLoan",
refinancePurpose: "HELOC"
}
Application Steps by Loan Flow
Every loan application has two phases:
Phase 1: Pre-Qualification - Collects basic information and presents initial rate options. Ends at the Rate Comparison step.
Phase 2: Qualification - Collects detailed financial, employment, and personal data. Ends at the Final Rate Comparison step and application submission.
The exact steps shown vary by loan type and may also be affected by company configuration. Below are the standard steps for each flow.
Purchase Flow
Loan Purpose: Purchase
Phase 1: Pre-Qualification
# | Step Key | Step Name | Description |
1 |
| Loan Purpose | Borrower selects "Purchase" |
2 |
| First-Time Homebuyer | Whether the borrower has owned a home in the last 3 years |
3 |
| VA Eligibility | VA loan eligibility (conditional) |
4 |
| Buying Stage | Where the borrower is in the buying process |
5 |
| Property Type | Single family, condo, townhouse, multi-unit, co-op, manufactured home |
6 |
| Property Usage | Primary residence, second home, or investment property |
7 |
| Property Location | ZIP code of the property |
8 |
| Property Address | Full property address (if contract is signed) |
9 |
| Purchase Price | Agreed purchase price |
10 |
| Home Budget | Target budget (if still searching) |
11 |
| Credit Profile | Self-reported credit score range |
12 |
| Down Payment | Down payment percentage |
13 |
| Working with Realtor | Whether they have a real estate agent |
14 |
| Keep Realtor in Loop | Option to loop in their realtor (conditional) |
15 |
| Realtor Info | Realtor contact details (conditional) |
16 |
| Personal Information | Borrower name, email, phone verification |
17 |
| Additional Questions | Custom company-specific questions (conditional) |
18 |
| Rate Comparison | View and select from available loan rate options |
Note: Steps 7-10 vary depending on the buying stage. Borrowers with a signed contract see PropertyAddress and PurchasePrice; those still searching see PurchaseLocation and Budget. Realtor steps appear based on borrower answers. VA Eligibility appears conditionally.
Phase 2: Qualification
# | Step Key | Step Name | Description |
19 |
| Full Personal Info | SSN, DOB, citizenship, marital status |
20 |
| Credit Report | Soft credit pull and report review |
21 |
| Property Information | Detailed property data |
22 |
| Title Holder | Title holder details |
23 |
| Residence History | Current and prior addresses (2-year history) |
24 |
| Income | Employment and income details |
25 |
| Assets | Bank accounts, investments, retirement |
26 |
| Real Estate Owned | Other properties owned |
27 |
| Down Payment Source | Source of down payment funds |
28 |
| Declarations | General URLA declarations |
29 |
| Property and Loan Declarations | Property and loan declarations |
30 |
| Financial Declarations | Financial history declarations |
31 |
| Military Service | Military service information |
32 |
| Education and Counseling | Homeownership education |
33 |
| Language Preferences | Preferred communication language |
34 |
| Demographics | HMDA demographic data |
35 |
| Review | Final review of all information |
36 |
| Final Rate Selection | Final loan option selection and submission |
Refinance Flow
Loan Purpose: Refinance
The Refinance flow has two variants:
Standard Refinance (lower rate, shorten term)
Cash-Out Refinance (take cash out, pay off credit cards, home improvement)
Phase 1: Pre-Qualification
# | Step Key | Step Name | Description |
1 |
| Loan Purpose | Borrower selects "Refinance" |
2 |
| VA Eligibility | VA loan eligibility (conditional) |
3 |
| Property Type | Type of property being refinanced |
4 |
| Property Usage | How the property is used |
5 |
| Property Address | Full property address |
6 |
| Property Value | Estimated current property value |
7 |
| Mortgage Balance | Current outstanding mortgage balance |
8 |
| Purpose of Refinance | Why they are refinancing |
9 |
| Cash-Out Amount | Desired cash-out amount (cash-out refinance only) |
10 |
| Credit Profile | Self-reported credit score range |
11 |
| Personal Information | Borrower name, email, phone verification |
12 |
| Additional Questions | Custom company-specific questions (conditional) |
13 |
| Rate Comparison | View and select from available rate options |
Note: Step 9 (Cash-Out Amount) only appears for cash-out refinance purposes.
Phase 2: Qualification
The Qualification phase for Refinance is the same as Purchase (steps 19-36 listed above), except DownPaymentSource does not apply.
HELOC Flow
Loan Purpose: AdditionalLoan | Refinance Purpose: HELOC
Phase 1: Pre-Qualification
# | Step Key | Step Name | Description |
1 |
| Loan Purpose | Borrower selects "HELOC/HELoan" |
2 |
| Loan Type Selection | Borrower selects "HELOC" as the type |
3 |
| Property Type | Type of property |
4 |
| Property Usage | How the property is used |
5 |
| Property Address | Full property address |
6 |
| Existing Mortgage | Current mortgage balance(s) on the property |
7 |
| Home Equity Amount | Total available home equity amount |
8 |
| Purpose | Why they are seeking home equity financing |
9 |
| Credit Profile | Self-reported credit score range |
10 |
| Personal Information | Borrower name, email, phone verification |
11 |
| Rate Comparison | View and select from available HELOC rate options |
Phase 2: Qualification
The Qualification phase for HELOC follows the same structure as other flows (see steps 19-36 in the Purchase section above).
Event Sequence Example
Below is the typical sequence of GTM events for a borrower completing a full application (the pattern is the same for all flows):
1. {prefix}-pre-qualification-started (application created)
2. {prefix}-step-started (first step loads)
3. {prefix}-step-completed (first step submitted)
... (step-started / step-completed pairs for each step) ...
4. {prefix}-step-completed (RateComparison submitted)
5. {prefix}-pre-qualification-completed (Phase 1 complete)
6. {prefix}-application-started (Phase 2 begins)
7. {prefix}-step-started (FullPersonalInfo loads)
... (step-started / step-completed pairs for each step) ...
8. {prefix}-step-completed (FinalRateComparison submitted)
9. {prefix}-application-completed (Full application submitted)
Using the Data in GTM
1. Create DataLayer Variables in your GTM container for each field:
event(built-in)companyName(Data Layer Variable)tag(Data Layer Variable)step(Data Layer Variable)borrowerId(Data Layer Variable)loanId(Data Layer Variable)loanPurpose(Data Layer Variable)refinancePurpose(Data Layer Variable)
2. Create Triggers based on event names:
Trigger for
{yourPrefix}-application-completedto fire conversion tagsTrigger for
{yourPrefix}-pre-qualification-completedto fire lead generation tagsTrigger for
{yourPrefix}-step-completedto track funnel progression
3. Common Tag Configurations:
Google Analytics 4: Map events to GA4 custom events with step, loanPurpose, borrowerId, and loanId as event parameters
Facebook/Meta Pixel: Fire Lead on pre-qualification-completed, fire CompleteRegistration on application-completed
Google Ads Conversion: Fire conversion tag on application-completed
Segmenting by Loan Type
Use the loanPurpose variable to segment analytics by loan type:
loanPurpose Value | Flow |
| Home purchase |
| Mortgage refinance |
| HELOC or second mortgage |
For HELOC specifically, you can also check refinancePurpose = "HELOC".
Funnel Analysis
The step variable combined with step-started and step-completed events enables detailed funnel analysis:
Drop-off analysis: Compare step-started counts vs. step-completed counts per step to identify where borrowers abandon the process
Time-to-complete: Use timestamps between step-started and step-completed for the same loanId to measure step duration
Conversion rate: Track the ratio of pre-qualification-started to application-completed for end-to-end conversion, segmented by loanPurpose
Flow comparison: Compare funnel performance across Purchase, Refinance, and HELOC flows using the loanPurpose field
Setup Requirements
To start receiving GTM events:
Provide your GTM Container ID (format: GTM-XXXXXXX) to your account administrator
The administrator will configure it in your company settings
Events will begin flowing to your container immediately for all new application sessions
No additional code or script installation is required on your part. The platform handles all GTM script loading and event management automatically.
Frequently Asked Questions
Q: Do I need to install any GTM code on my website?
A: No. The platform automatically loads your GTM container and manages the dataLayer. You only need to configure tags and triggers within your GTM workspace.
Q: Can I track which specific step borrowers drop off on?
A: Yes. Every step transition fires both step-completed (for the step being left) and step-started (for the next step). By comparing counts, you can pinpoint exact drop-off steps.
Q: Are events fired for returning borrowers who resume an application?
A: Yes. When a borrower returns to a saved application, a step-started event fires for the step they resume on.
Q: How do I distinguish between HELOC and other loan types in my analytics?
A: Use the loanPurpose field ("AdditionalLoan" for HELOC) and/or the refinancePurpose field ("HELOC") in your GTM triggers or GA4 event parameters.
Q: Is any personally identifiable information (PII) included in the events?
A: No. The dataLayer only contains opaque identifiers (borrowerId, loanId) and application metadata. No names, emails, SSNs, or other PII is included in events.
For questions about this integration or to request your GTM Container ID be configured, please contact your account representative.
