The User Data Collector is a free web Google Tag Manager (GTM) tag that automatically extracts customer information, including email addresses, phone numbers, names, and location data, from website forms and supported HTML elements.
The tag can push collected information to the dataLayer or store it in Session Storage or Local Storage, making it available to other GTM tags and tracking platforms.
Data collection can be triggered automatically by form submissions, submit button clicks, or custom CSS selectors. You can also define the scanning scope and choose whether new data replaces or merges with previously collected information.
The tag is particularly useful for multi-step forms, allowing you to capture customer details at the beginning of a form and retain them until a conversion event is triggered.
When combined with Stape's Enricher power-up, the collected first-party user data can enrich incoming server-side events, helping build more complete user profiles and improve conversion matching.
Collecting useful customer information is an important part of accurate conversion tracking. But getting that data from website forms and other page elements can involve custom scripts, manual field mapping, and additional development work. The User Data Collector tag by Stape makes this process easier.
It's a free web Google Tag Manager (GTM) tag that automatically scans your website, identifies user information, and extracts details such as email addresses, phone numbers, names, and location data. You can then make this information available to your other GTM tags through the dataLayer or browser storage. Instead of writing custom code to collect and organize form data, you can use the tag to capture it automatically and decide when and where it should be available.
Website interactions provide valuable information about visitors, but standard tracking events don't always include enough details to identify or match them across platforms. For example, a purchase event might tell you that someone completed an order, but it may not contain an email address or phone number that an advertising platform can use for conversion matching.
When user data is available and collected with appropriate consent, identifiers can help advertising platforms match conversion events to their users. This can improve conversion attribution and give their algorithms more information for campaign optimization.
The challenge is making this information available consistently. Customer details may be entered into different forms, stored in different page elements, or become available only after a particular interaction. Manually collecting these values can require additional development and ongoing maintenance.
The tag can identify and extract several types of user information from forms and supported HTML elements:
You can choose which data types you want to collect, so you don't have to extract information that isn't relevant to your tracking needs. The tag also handles how the collected information is stored and shared with the rest of your GTM setup:
DataLayer integration: push the collected information to the dataLayer through a customizable event. Other GTM tags can then use this event to access the extracted data.
Browser storage: save user information in Session Storage or Local Storage so it remains available when visitors navigate between pages. Session Storage keeps data for the current browser session, while Local Storage can retain it beyond that session until it is cleared.
Automatic data collection: trigger extraction when visitors click submit buttons or submit forms. You can also specify CSS selectors to determine which elements should initiate collection.
Custom scanning scope: limit extraction to a particular HTML element instead of scanning the entire page. This is useful when your website contains multiple forms or sections with different types of information.
Flexible data updates: choose whether newly collected information should replace previously captured data or be merged with it.
This tag is particularly useful for collecting user data from various forms across your website. It can push the collected data to the Data Layer, allowing you to use it as needed and send it to different platforms. Combined with the Enricher power-up, it can further improve data collection by enriching incoming events with first-party user data and building more complete user profiles.
Another advantage is that you don’t need to configure data collection manually, as the tag can automatically gather user data based on your settings. It is especially useful when working with multi-step forms.
For instance, in the first step, you collect and save the user’s data using this tag. The form can then continue with additional steps, such as answering questions or completing a quiz. Based on the user’s answers to specific questions, you can determine which conversion event should be triggered. This allows you to capture user data at the very beginning of the multi-step form and retain it for use when a conversion event is triggered.
1. Add the User Data Collector tag template in the web GTM container by importing it from the Template gallery:
2. Create the User Data Collector tag:
Go to the Tags menu → click New.
Click Tag Configuration → select User Data Collector.
3. Configure the User Data Collector tag:
User Data to be Collected - choose all types of user data you wish to extract from the page.
Configuration:
Save user_data information into the browser Storage - allows you to save the captured user information to Session or Local Storage. If you enable it, select a Storage Type and Storage Key (if not set, gtm_user_data will be used).
Push an event to the dataLayer with user_data information - allows you to send an event to dataLayer, for example, to capture user_data information after a specific dataLayer event occurs. If enabled, enter a Data Layer Event Name and Data Layer Array Name.
Automatically track clicks at specific type="submit" button and input HTML elements - tracks submit events at all <form> HTML elements by default and tries to detect user_data information. If enabled, specify a CSS selector for elements that should trigger data extraction on click (defaults to button[type="submit"] and input[type="submit"] if left blank).
Automatically track submit events on form HTML elements - tracks submit events at all <form> HTML elements by default and tries to detect user_data information. If enabled, specify a CSS selector for elements that should trigger data extraction on the submit event (defaults to form If left blank).
Override the root HTML element to scan within - instead of the root HTML element, the tag will only scan the GTM variable. If enabled, provide a GTM variable that returns an HTML element. By default, it scans the entire document.
Override the already captured user data with the newly captured values - existing user_data will be overridden with the newly captured data, instead of the default way of merging it with the already existing one.
More Settings - enter a
Script URL to load the collector script from. Default URL is
https://stapecdn.com/udc/${script-version}.js, which loads the latest script version. You can lock a specific version instead by replacing the placeholder
${script-version} with the version number (e.g.,
v1).
Logs Settings - choose if you want to log requests to your account. This feature is handy when setting up server-side tagging since it allows seeing incoming and outgoing requests and network responses.
Advanced Settings:
Tag firing priority - enter a number to assign the tag a priority (defaults to 0 if none is specified). Tags with higher numbers have a higher priority and will be fired first.
Enable custom tag firing schedule - allows you to define a specific date and time to fire the tag.
Only fire this tag in published containers - allows you to avoid firing the tag in testing environments (if, for instance, firing this tag results in a fee being charged).
Tag firing options - choose whether you wish the tag to fire once per event, once per page, or every time it’s triggered.
Tag Sequencing - you can assign specific tags to fire immediately before and after the current tag.
Additional Tag Metadata - specify additional tag metadata to be included in the event data when the tag is fired.
Consent Settings - choose if you wish for the tag to wait for marketing consent from the user before firing.
4. Add a Trigger for the tag, give it a descriptive name, and click Save.
You can test the configurations in Google Tag Manager. Click on Preview, trigger the event, and check whether the tag has fired.
Collecting user information shouldn't require writing and maintaining custom scripts for every form on your website. The User Data Collector makes it easier to identify useful customer details, store them, and make them available throughout your Google Tag Manager setup.
Whether you're working with lead generation forms, ecommerce checkouts, enhanced conversions, or server-side tracking, the tag can help simplify data collection and make your tracking setup more consistent.
Comments