Skip to main content

Google Tag Manager (GTM) Integration Guide

Complete guide to GTM analytics integration on the Optimus platform, covering Purchase, Refinance, and HELOC loan application flows, event types, data payloads, and setup instructions.

Updated today

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

{prefix}-pre-qualification-started

Pre-Qualification Started

When the borrower creates a new application and the first step loads

{prefix}-step-started

Step Started

Each time the borrower navigates to a new step

{prefix}-step-completed

Step Completed

Each time the borrower successfully completes/submits a step

{prefix}-pre-qualification-completed

Pre-Qualification Completed

When Phase 1 (Pre-Qualification) is submitted

{prefix}-application-started

Application Started

When Phase 2 (Full Qualification) begins

{prefix}-application-completed

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

event

string

The full event name including your company prefix

"AL-step-completed"

companyName

string

Your company name

"Acme Lending"

tag

string

The raw event type

"step-completed"

step

string

The step identifier the borrower is on

"PropertyType", "Income"

borrowerId

string

Unique identifier of the primary borrower

"b8f3e2a1-4c5d-..."

loanId

string

Unique identifier of the loan application

"a4d7c9e2-1b2c-..."

loanPurpose

string (optional)

The selected loan purpose

"Purchase", "Refinance", "AdditionalLoan"

refinancePurpose

string (optional)

Sub-purpose for refinance or HELOC flows

"LowerRate", "HELOC"

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

LoanPurpose

Loan Purpose

Borrower selects "Purchase"

2

FirstTimeHomeBuyer

First-Time Homebuyer

Whether the borrower has owned a home in the last 3 years

3

VaEligibility

VA Eligibility

VA loan eligibility (conditional)

4

PurchaseProcessType

Buying Stage

Where the borrower is in the buying process

5

PropertyType

Property Type

Single family, condo, townhouse, multi-unit, co-op, manufactured home

6

PropertyUsageDetails

Property Usage

Primary residence, second home, or investment property

7

PurchaseLocation

Property Location

ZIP code of the property

8

PropertyAddress

Property Address

Full property address (if contract is signed)

9

PurchasePrice

Purchase Price

Agreed purchase price

10

Budget

Home Budget

Target budget (if still searching)

11

CurrentCreditProfile

Credit Profile

Self-reported credit score range

12

DownPayment

Down Payment

Down payment percentage

13

WorkingWithRealtor

Working with Realtor

Whether they have a real estate agent

14

RealtorInLoop

Keep Realtor in Loop

Option to loop in their realtor (conditional)

15

RealtorInfo

Realtor Info

Realtor contact details (conditional)

16

PersonalInfo

Personal Information

Borrower name, email, phone verification

17

AdditionalQuestions

Additional Questions

Custom company-specific questions (conditional)

18

RateComparison

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

FullPersonalInfo

Full Personal Info

SSN, DOB, citizenship, marital status

20

CreditProfile

Credit Report

Soft credit pull and report review

21

PropertyInformation

Property Information

Detailed property data

22

TitleHolder

Title Holder

Title holder details

23

ResidenceInfo

Residence History

Current and prior addresses (2-year history)

24

Income

Income

Employment and income details

25

Assets

Assets

Bank accounts, investments, retirement

26

Reo

Real Estate Owned

Other properties owned

27

DownPaymentSource

Down Payment Source

Source of down payment funds

28

DeclarationsGeneral

Declarations

General URLA declarations

29

PropertyAndLoan

Property and Loan Declarations

Property and loan declarations

30

YourFinances

Financial Declarations

Financial history declarations

31

MilitaryServices

Military Service

Military service information

32

HomeownershipEducationAndHousingCounseling

Education and Counseling

Homeownership education

33

LanguagePreferences

Language Preferences

Preferred communication language

34

DemographicInformation

Demographics

HMDA demographic data

35

Review

Review

Final review of all information

36

FinalRateComparison

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

LoanPurpose

Loan Purpose

Borrower selects "Refinance"

2

VaEligibility

VA Eligibility

VA loan eligibility (conditional)

3

PropertyType

Property Type

Type of property being refinanced

4

PropertyUsageDetails

Property Usage

How the property is used

5

PropertyAddress

Property Address

Full property address

6

PropertyValue

Property Value

Estimated current property value

7

CurrentMortgageBalance

Mortgage Balance

Current outstanding mortgage balance

8

PurposeOfRefinance

Purpose of Refinance

Why they are refinancing

9

CashOutAmount

Cash-Out Amount

Desired cash-out amount (cash-out refinance only)

10

CurrentCreditProfile

Credit Profile

Self-reported credit score range

11

PersonalInfo

Personal Information

Borrower name, email, phone verification

12

AdditionalQuestions

Additional Questions

Custom company-specific questions (conditional)

13

RateComparison

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

LoanPurpose

Loan Purpose

Borrower selects "HELOC/HELoan"

2

AdditionalLoanSecondMortgageType

Loan Type Selection

Borrower selects "HELOC" as the type

3

PropertyType

Property Type

Type of property

4

PropertyUsageDetails

Property Usage

How the property is used

5

PropertyAddress

Property Address

Full property address

6

AdditionalLoanHelocExistingMortgage

Existing Mortgage

Current mortgage balance(s) on the property

7

AdditionalLoanHelocHighBalance

Home Equity Amount

Total available home equity amount

8

AdditionalLoanHomeEquityCreditPurpose

Purpose

Why they are seeking home equity financing

9

CurrentCreditProfile

Credit Profile

Self-reported credit score range

10

PersonalInfo

Personal Information

Borrower name, email, phone verification

11

RateComparison

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-completed to fire conversion tags

  • Trigger for {yourPrefix}-pre-qualification-completed to fire lead generation tags

  • Trigger for {yourPrefix}-step-completed to 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

Purchase

Home purchase

Refinance

Mortgage refinance

AdditionalLoan

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:

  1. Provide your GTM Container ID (format: GTM-XXXXXXX) to your account administrator

  2. The administrator will configure it in your company settings

  3. 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.

Did this answer your question?