The purpose of this article is to demonstrate tracking implementations for non-retail user interactions with eCommerce sites, including subscriptions via form submission and event scheduling via HubSpot.
The implementations recommended below include data layer support and Google Analytics 4 (GA4) tags.
Developer required for data layer support.
Subscriptions and lead-generation usually involve collecting user information for future interactions. One of the most common lead-gen solutions is to embed a form one a website.
The four steps below detail our recommended tracking implementation for the demo form above.
Step 1: Data Layer Push
Execute the following script after successful form submissions. This should done programmatically from the website.
})("generate_lead","John", "Smith", "firstname.lastname@example.org" )
Where the function accepts user inputs from the form submission.
Step 2: Data Layer Variables
For this implementation, a data layer variable should be created to capture each of the data variables pushed in Step 1. Due to the structure of the data layer push, we preface each of these with "data."
The actual name of the variables in GTM may vary based on your preferred naming convention, but the Data Layer Variable Name shown above must exactly match what is demonstrated, assuming you also use the exact data layer push that was demonstrated in Step 1.
Data layer variables should also be created for data.last_name and data.email.
Step 3: Tag & Trigger
Demonstrated below is a GA4 Event that captures each of the variables created in the previous step. .
Trigger - The Tag should be trigger by the data layer event pushed in Step 1. Create a Custom Event Trigger and input the Event name "generate_lead".
Step 4 - Validation
After creating the variables, tag and trigger above, click Preview in GTM to test the implementation.
Submit the form and ensure that the you see your tag fire in Tag Assistant, like below.
Scheduling may be for the purposes of a demo, sales call or consultation.
Two of the most common solutions for scheduling are Calendly and HubSpot. We have provided links to guides for each below.