「GTM」Using Element Visibility for Form Submission Tracking | BCS 「GTM」Using Element Visibility for Form Submission Tracking | BCSBCS

「GTM」Using Element Visibility for Form Submission Tracking

Google Tag Manager BCS 5 years ago (2019-12-10) 2532 Views 0 Comments

Update time: January 13, 2025

This article introduces how to use element visibility in Google Tag Manager to track form submissions.

Meet Element Visibility

 Element visibility trigger fires when a selected element becomes visible in the web browser’s viewport. 

The setting interface for Element visibility is as follows:

「GTM」Using Element Visibility for Form Submission Tracking

 

  • Selection Method: is to locate a specific location, you can use the ID attribute or CSS selector:
    • ID: Selects a single element based on the value of an element’s ID attribute.
    • CSS Selector: Selects one or more elements based on a specified CSS selector pattern.
  • When to fire this trigger:Used to set the trigger frequency, there are three types:
    • Once per page
    • Once per element:
    • Every time an element appears on-screen
  • Advanced:There are three advanced settings:
    • Minimum Percent Visible: Triggered when the visible ratio reaches a certain value, the default is 50%.
    • Set minimum on-screen duration: Triggered when the display time reaches a certain length, the unit is milliseconds.
    • Observe DOM changes: Check this box to enable the trigger to track matched elements that appear as the DOM changes.

 

Case Presentation

Now we need to track the form submission in https://www.bbccss.com/contact-form-7. If the form submission is successful, it will be displayed:

「GTM」Using Element Visibility for Form Submission Tracking

If yours does not have a similar display, this method will not apply.

 

Step 1 : Set Up the Trigger

Move the mouse to track the position, and then view the page elements:「GTM」Using Element Visibility for Form Submission Tracking

There is a class attribute, which is wpcf7-response-output, and can be positioned using a CSS selector.

In GTM , click「Triggers」——「New」——「Choose a trigger type to begin setup…」——「Custom Event」,Name it “Element Visibility—Submit Form”, and make the following settings:「GTM」Using Element Visibility for Form Submission Tracking

The reason why the element selector is set to div.wpcf7-response-output is because this class is in a div. 

Click Text contains Thanks is limited to triggering only if the display text contains Thanks.

 

Step 2 : Set Up the Tags

In GTM , click「Tags」——「New」——「Choose a tags type to begin setup…」——「Google Analytics: GA4 Event」,Name it “GA4-Event-Submit Form(Element Visibility) “, and make the following settings:

「GTM」Using Element Visibility for Form Submission Tracking

 

The event name is submit_form_element_visibility.

 

Step 3 : Preview and Publish

Next is preview debugging.「GTM」Using Element Visibility for Form Submission Tracking

Tags is triggered and can be published.

Read More:

 

Step 4 : Verify Data in Reports

Generally, after 24 hours, we can see the data in GA4, such as:「GTM」Using Element Visibility for Form Submission Tracking

 


If you don't understand, You can leave a comment below.
Like (0)
Post my comment
Cancel comment
Expression Bold Strikethrough Center Italic

Hi, you need to fill in your nickname and email!

  • Nickname (required)
  • Email (required)
  • Website