Google Analytics for registration flow

Introduction

This guide shows how to integrate an IBM Security Verify registration flow with Google Analytics via Google Tag Manager. This can help you analyze user journeys to identify and remediate potential reasons for registration abandonment. Google Analytics provides a number of reports and reporting options to assist organizations in measuring critical business metrics to take immediate action to drive outcomes that matter today.

Pre-requisites

To get started, you will need:

  1. A registration flow created in IBM Security Verify. See how to create a registration flow.
  2. The client ID and client secret for an API client in your IBM Security Verify tenant with "Manage Templates" permission. See how to create an API client.
  3. A Google Analytics account and a Google Analytics 4 property with related measurement ID.
  4. A Tag Manager container snippet.
  5. The cURL utility to make HTTP calls to REST APIs.

Registration flow in IBM Security Verify

For this guide, we'll assume a registration flow with the following form fields:

  • first name
  • last name
  • age
  • mobile number
  • email ID
  • password.
    Verification of the email address is also assumed to be enabled.
1920

Example registration flow page

Themes

This guide shows how to download, modify, and update the default theme in your IBM Security Verify tenant. If you prefer to create a new theme, check out Managing themes.

Install Tag Manager

The Google Tag Manager container snippets are small HTML and JavaScript snippets that you paste into your pages. They allow Tag Manager to fire tags by loading gtm.js onto each page.

There are two snippets; one for the head section and the other for the body section of the page.

Installing Tag Manager in your registration flow consists of four simple steps:

  1. Get access token.
  2. Downloading templates files.
  3. Inserting Tag Manager codes in template files
  4. Publishing new template files.

1. Get access token

You'll need the client ID and client secret of an API client which has access to manage templates to receive the access token. Once you have these, make an API call with your client_id, client_secret, and tenant_url:

export tenant_url=tenant.verify.ibm.com
export client_id=12345678-1234-1234-1234-123456789012
export client_secret=abcd1234
curl -X POST https://${tenant_url}/v1.0/endpoint/default/token -d "client_id=${client_id}&client_secret=${client_secret}&grant_type=client_credentials"

In response, you will get the access_token required for the next steps. For more details on this, check out the Client Credentials flow.

2. Download default theme package

A theme package contains the template files for a theme. To get the default theme package, make an API call to your tenant using the access token you obtained in the previous step:

export tenant_url=tenant.verify.ibm.com
export access_token=iZ5Gfz66HsNYSoJxhVe7N3u6cdBCHFYWgDOCAsNF
curl -H "Authorization: Bearer ${access_token}" -X GET "https://${tenant_url}/v1.0/branding/themes/default" -o default-theme.zip

A default-theme.zip file will get downloaded to your current directory.

3. Insert Tag Manager snippets into Template Files

To install Tag Manager in your registration flow, you need to edit your registration flow template files.
To do so, unzip the theme package to extract the various template files. The HTML file used by the registration flow pages can be found in templates > user_flows > registration > default > registration.html

Paste your Tag Manager container snippets in the head and body sections of this page.

4. Upload the updated default theme package

Once you've made the necessary changes, zip the updated template folder such that the zip file contains the "templates" folder inside it. Then use the following API request to upload the updated zip file:

curl -H "Authorization: Bearer ${access_token}" -X PUT "https://${tenant_url}/v1.0/branding/themes/default -F [email protected]

A 201 Created response indicates a successful API call.

Note: Replace updated-theme.zip with the name of your zip file, and if the file isn't in your current directory, use the complete file path.

You can check the Tag Manager connection by running your registration flow in "Preview" mode. After successful installation, it will show Connected! on the Tag Assistant Page.

Tag Manager: Tags, Triggers and Variables

After successfully installing Tag Manager, you'll need to create Tags, Triggers, and Variables so you can begin tracking various events from your form.

To begin, you can copy the Tag Manager container items file and import it into your Tag Manager account. Then, according to your registration flow, you can make the necessary changes. For guidance on how to import a Tag Manager container, see this document on Container export and import.

After importing the container items file, you'll get the following variables, triggers, and tags:

  1. Variables: There are two user-defined variables:

    • Custom JavaScript - Page Title: This is a custom JavaScript variable that stores the page title.
    • Data Layer Variable - User Attribute: This is a data layer variable that stores the user attribute of the form elements.
  2. Triggers: It contains a number of different Triggers for tracking form events. There are two types of Triggers used here:

    • All Element: These triggers fire when the user clicks on any element on the page and the data layer variable contains a specific value.
    • Page View: These triggers are activated when a page is viewed and contains the specified title.
  3. Tags: It contains tags for each event. Tags used here are also of two types:

    • GA4 Configuration: It is a Google Analytics configuration tag. Using this connection between your Google Analytics Account and Tag Manager account is created.
    • GA4 Event: These tags are responsible for sending events to the Google Analytics account you've set up.

Note: In the GA4 Configuration tag, replace G-12345678 with your Google Analytics Measurement ID.

Now, if you start the "Preview" mode from your Tag Manager account, you should see tags firing for different events on your registration flow.

View analytics on Google Analytics platform

You can use the events you get from your registration flow to create various charts in Google Analytics to investigate different patterns.

1. Funnel Chart

Funnel charts are popular for analyzing different stages of a process.

1920

Funnel chart in Google Analytics

The above funnel report provides a few bits of information that we may directly use.

  1. The drop-off and conversion rate for every event in your registration flow.
  2. When and how many users are abandoning your registration flow.
  3. The average time it takes for a user to move from one step to the next.

2. Path Exploration

1920

Path exploration in Google Analytics

Path Exploration will show you the different ways the users travelled through your registration flow. You can either look for steps done by users when they first enter the flow or the steps taken by users who have completed the targeted action.

Assets

Tag Manager container items file
{
    "exportFormatVersion": 2,
    "exportTime": "2021-10-07 06:31:51",
    "containerVersion": {
        "path": "accounts/1234567890/containers/12345678/versions/0",
        "accountId": "1234567890",
        "containerId": "12345678",
        "containerVersionId": "0",
        "container": {
            "path": "accounts/1234567890/containers/12345678",
            "accountId": "1234567890",
            "containerId": "12345678",
            "name": "Registration",
            "publicId": "GTM-ABCDEFG",
            "usageContext": [
                "WEB"
            ],
            "fingerprint": "1631538135313",
            "tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/1234567890/containers/12345678/workspaces?apiLink=container"
        },
        "tag": [
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "3",
                "name": "GA4 Configuration",
                "type": "gaawc",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "sendPageView",
                        "value": "true"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "enableSendToServerContainer",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "measurementId",
                        "value": "G-12345678"
                    }
                ],
                "fingerprint": "1631538198223",
                "firingTriggerId": [
                    "2147479553"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "10",
                "name": "Google Analytics GA4 Event - First Name",
                "type": "gaawe",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "first_name"
                    },
                    {
                        "type": "TAG_REFERENCE",
                        "key": "measurementId",
                        "value": "GA4 Configuration"
                    }
                ],
                "fingerprint": "1631555361690",
                "firingTriggerId": [
                    "9"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "18",
                "name": "Google Analytics GA4 Event - Reg Complete",
                "type": "gaawe",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "reg_complete"
                    },
                    {
                        "type": "TAG_REFERENCE",
                        "key": "measurementId",
                        "value": "GA4 Configuration"
                    }
                ],
                "fingerprint": "1631556063302",
                "firingTriggerId": [
                    "17"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "19",
                "name": "Google Analytics GA4 Event - Last Name",
                "type": "gaawe",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "last_name"
                    },
                    {
                        "type": "TAG_REFERENCE",
                        "key": "measurementId",
                        "value": "GA4 Configuration"
                    }
                ],
                "fingerprint": "1631556165151",
                "firingTriggerId": [
                    "11"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "20",
                "name": "Google Analytics GA4 Event - Age",
                "type": "gaawe",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "age"
                    },
                    {
                        "type": "TAG_REFERENCE",
                        "key": "measurementId",
                        "value": "GA4 Configuration"
                    }
                ],
                "fingerprint": "1631556192688",
                "firingTriggerId": [
                    "12"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "21",
                "name": "Google Analytics GA4 Event - Moible Number",
                "type": "gaawe",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "mobile_number"
                    },
                    {
                        "type": "TAG_REFERENCE",
                        "key": "measurementId",
                        "value": "GA4 Configuration"
                    }
                ],
                "fingerprint": "1631556215405",
                "firingTriggerId": [
                    "13"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "22",
                "name": "Google Analytics GA4 Event - Email",
                "type": "gaawe",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "email"
                    },
                    {
                        "type": "TAG_REFERENCE",
                        "key": "measurementId",
                        "value": "GA4 Configuration"
                    }
                ],
                "fingerprint": "1631556246636",
                "firingTriggerId": [
                    "14"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "23",
                "name": "Google Analytics GA4 Event - Password",
                "type": "gaawe",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "password"
                    },
                    {
                        "type": "TAG_REFERENCE",
                        "key": "measurementId",
                        "value": "GA4 Configuration"
                    }
                ],
                "fingerprint": "1631556267589",
                "firingTriggerId": [
                    "15"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "30",
                "name": "Google Analytics GA4 Event - Registration Submitted",
                "type": "gaawe",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "registration_submitted"
                    },
                    {
                        "type": "TAG_REFERENCE",
                        "key": "measurementId",
                        "value": "GA4 Configuration"
                    }
                ],
                "fingerprint": "1632910545413",
                "firingTriggerId": [
                    "27"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "31",
                "name": "Google Analytics GA4 Event - Email Verified",
                "type": "gaawe",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "email_verified"
                    },
                    {
                        "type": "TAG_REFERENCE",
                        "key": "measurementId",
                        "value": "GA4 Configuration"
                    }
                ],
                "fingerprint": "1632910508083",
                "firingTriggerId": [
                    "28"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "tagId": "33",
                "name": "Google Analytics GA4 Event - Registration Started",
                "type": "gaawe",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "registration_started"
                    },
                    {
                        "type": "TAG_REFERENCE",
                        "key": "measurementId",
                        "value": "GA4 Configuration"
                    }
                ],
                "fingerprint": "1632912208797",
                "firingTriggerId": [
                    "32"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            }
        ],
        "trigger": [
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "9",
                "name": "All Elements - First Name",
                "type": "CLICK",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Data Layer Variable - User Attribute}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "given_name"
                            }
                        ]
                    }
                ],
                "fingerprint": "1631555321646"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "11",
                "name": "All Elements - Last Name",
                "type": "CLICK",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Data Layer Variable - User Attribute}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "family_name"
                            }
                        ]
                    }
                ],
                "fingerprint": "1631555466852"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "12",
                "name": "All Elements - Age",
                "type": "CLICK",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Data Layer Variable - User Attribute}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "age"
                            }
                        ]
                    }
                ],
                "fingerprint": "1631555499754"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "13",
                "name": "All Elements - Mobile Number",
                "type": "CLICK",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Data Layer Variable - User Attribute}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "mobile_number"
                            }
                        ]
                    }
                ],
                "fingerprint": "1631555526821"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "14",
                "name": "All Elements - Email",
                "type": "CLICK",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Data Layer Variable - User Attribute}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "email"
                            }
                        ]
                    }
                ],
                "fingerprint": "1631555567683"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "15",
                "name": "All Elements - Password",
                "type": "CLICK",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Data Layer Variable - User Attribute}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "password"
                            }
                        ]
                    }
                ],
                "fingerprint": "1631555598887"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "17",
                "name": "Page View - Page Title - Account Created",
                "type": "PAGEVIEW",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Custom JavaScript - Page Title}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "Your account is created"
                            }
                        ]
                    }
                ],
                "fingerprint": "1631556025189"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "27",
                "name": "Page View - Page Title - Let's verify your email",
                "type": "PAGEVIEW",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Custom JavaScript - Page Title}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "Let's verify your email"
                            }
                        ]
                    }
                ],
                "fingerprint": "1632910171782"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "28",
                "name": "Page View - Page Title - Your email is verified",
                "type": "PAGEVIEW",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Custom JavaScript - Page Title}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "Your email is verified"
                            }
                        ]
                    }
                ],
                "fingerprint": "1632910190088"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "29",
                "name": "Page View - Page Title - Your account is created",
                "type": "PAGEVIEW",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Click ID}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "Your account is created"
                            }
                        ]
                    }
                ],
                "fingerprint": "1632910148400"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "triggerId": "32",
                "name": "Page View - Page Title - Create an account",
                "type": "PAGEVIEW",
                "filter": [
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Custom JavaScript - Page Title}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "Create an account"
                            }
                        ]
                    }
                ],
                "fingerprint": "1632912190686"
            }
        ],
        "variable": [
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "variableId": "8",
                "name": "Data Layer Variable - User Attribute",
                "type": "v",
                "parameter": [
                    {
                        "type": "INTEGER",
                        "key": "dataLayerVersion",
                        "value": "2"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "name",
                        "value": "gtm.element.dataset.userAttribute"
                    }
                ],
                "fingerprint": "1631555278869",
                "formatValue": {}
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "variableId": "16",
                "name": "Custom JavaScript - Page Title",
                "type": "jsm",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "javascript",
                        "value": "function () {\n  return document.getElementById('title').textContent\n}"
                    }
                ],
                "fingerprint": "1631555959149",
                "formatValue": {}
            }
        ],
        "builtInVariable": [
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "type": "PAGE_URL",
                "name": "Page URL"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "type": "PAGE_HOSTNAME",
                "name": "Page Hostname"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "type": "PAGE_PATH",
                "name": "Page Path"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "type": "REFERRER",
                "name": "Referrer"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "type": "EVENT",
                "name": "Event"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "type": "CLICK_ID",
                "name": "Click ID"
            },
            {
                "accountId": "1234567890",
                "containerId": "12345678",
                "type": "CLICK_TEXT",
                "name": "Click Text"
            }
        ],
        "fingerprint": "1633588311214",
        "tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/1234567890/containers/12345678/versions/0?apiLink=version"
    }
}

💎

Priti Patil, IBM Security

Naveen Kumar, IBM Security