Ads Conversion, Target and E-commerce transactions (also referable as events or triggers) processes involve scenarios such as PageView and Click that can act as triggers.
In this article, I’ll provide a bit more detail regarding triggers. Facebook Pixel and Google Global Site Tag come pre-configured with the PageView event (hitType).
You can find support requests for Google Tag Manager.
In the usage of Google Ads conversion code, we can create conversions based on page views. However, our requirements may also extend beyond page views. Let’s first briefly recall how page view-based event delivery works.
Page View
Google Ads > Measurement > Conversions, when we define a conversion action, the default tag is presented as Page View (Load). Additionally, the Global Site Tag (used for both Ads and Google Analytics) code previously passed also processes page view (and, for Google Ads, performs a re-targeting function).
Therefore, if a conversion occurs upon page load (for example, after checkout or form submission, such as a thank-you page), no additional configuration is required. Of course, in GTM usage, specific page identification must be specified.
If the configuration for the Page Trigger under GTM > Page View > Some Page Views > Page URL (+condition) is incorrectly set, the conversion tag will either run on every page or fail to execute because the condition is not met. For usage with the Global Site Tag, the structure we will use is as follows:
gtag('event', [event], {
'event_category': [event-category],
'event_label': [event-label],
'value': [event-value]
});
This structure can be seen in the Ads conversion code. Additionally, you can refer to the GTAG’s predefined event list1 and start using the predefined events such as ecommerce and engagement. For demonstration purposes, let’s create a simple event for a page viewed after a user signs up. Let’s assume this event is triggered via Google Sign-In2.
gtag('event', 'sign_up', { 'method': 'Google' });
As of July 2023, Universal Analytics (UA) is being phased out in favor of Google Analytics 4 (GA4). After this date, UA properties will no longer be able to process new data. They are expected to become inaccessible by the end of the year. For details on differences between property types and other operations, please refer to the article titled Universal Analytics (UA) to Google Analytics 4 (GA4). You may also request technical support at (https://calendly.com/dnomia/15min).
Button Click, Link Click, Phone Call, and File Download
We might be required to trigger conversions through methods other than page viewing. Among these, link and button clicks are frequently preferred, either directly linked to a link or button, or within an external process (again, via a click action). For example, when you define a trigger for a submit button in a form, you’ll also need to evaluate the validation process within the form content. In the article titled “Contact Form 7 Conversion Setup”, we previously used events passed by an extension as an example for this scenario. Let’s examine the conversion code for Google Ads click events.
<!-- Event snippet for .... conversion page
In your HTML page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->
<script>
function gtag_report_conversion(url) {
var callback = function () {
if (typeof(url) != 'undefined') {
window.location = url;
}
};
gtag('event', 'conversion', {
'send_to': 'AW-123456789/abCdEFG1hIjKlMno2pR',
'event_callback': callback
});
return false;
}
</script>
We can use the above conversion code in the format <a href="#" onClick="return gtag_report_conversion(url);">Link Text</a>. The same process can be repeated when using buttons instead of links. To select the appropriate trigger via GTM, we can evaluate the options under Trigger Type > Click > All Elements or Only Links > Built-in Variables, particularly focusing on the options such as Form Classes, Form ID, Click Element, Click Classes, Click ID, Click URL, and Click Text.
For example, if we consider links containing phone call actions as conversions, Click Text can identify the number itself, Click URL can define the phone number link as tel://, Click ID and Click Classes can point to class and ID values, and we can process the conversion upon click. However, some form operations may include validation and control checks. In such cases, directly adding the event line inside the relevant validation and control functions will suffice.
gtag('event', 'conversion', {
'send_to': 'AW-123456789/abCdEFG1hIjKlMno2pR',
'event_callback': callback
});
For example, you may refer to the code block below.
If we wish to directly use GTAG activation outside of functions and/or GTM, our example would look like this: <a href="#" onClick="gtag('event', 'login', { 'method': 'Google' });">Connection Text</a>. Indeed, in addition to the page view and click trigger types mentioned above, we can proceed to the trigger types under the “User Engagement” section, which specifically define specific scenarios and link them to actions (conversions, targets, and similar).
User Engagement
The triggers under the “User Engagement” section focus on in-page user actions, such as viewings (video, scroll, element) and submissions (form). Using these events, we can also differentiate the conversion scenarios we define. For instance, we can define page depth and/or element view as conversion triggers for a content’s engagement rate, or evaluate processes such as video playback, viewing for a specific duration, or full playback.
Form Submission
During the form submission process (submit), the button (e.g., Click Classes, Click ID, Click Text) and form values (e.g., Form Classes, Form ID, Form URL) can be used in relation to the event. The same applies to GTAG. After form validation and confirmation of the content, relevant conversion or other actions can be triggered. For more details on how this process is handled with WordPress Contact Form 7, refer to the article on wpcf7mailsent.
There are also various methods we can use. In the GTM setup, under Variables > Built-in Variables, you can configure variables such as Click ID, Click Target, Click Test, Click URL, Form Classes, Form Element, Form ID, Form Target, Form Text, and Form URL. In the form trigger configuration section, you will see the Wait for Tags and Validate fields3. When all actions specified as conditions (those that appear when you select the relevant field) are triggered (all defined variables; for example, Page URL, Click ID, Scroll Depth) and/or after the specified time duration in milliseconds, the gtm.formSubmit event will be successfully triggered. If neither condition is met, the action will not be triggered. The Validate option triggers the action only when the form is successfully submitted.
Scroll Depth (Scroll Engagement)
We can also use scroll movements as triggers. This enables us to track how much of a page’s content has been viewed or which section of the page has been engaged with, and take appropriate actions based on that. We can evaluate the movement along the x (horizontal) and y (vertical) axes.
The movement along a specific axis can be defined either as a percentage of the page width or directly in pixels. This allows, for example, to report scroll depth percentages (10%, 50%, and 100%) of a content page as separate Google Analytics events, or to treat the 100% scroll completion as a conversion. The relevant action is processed under gtm.scrollDepth. The output defined as a percentage of vertical and page width is as follows.
{
event: 'gtm.scrollDepth',
gtm.scrollThreshold: 100,
gtm.scrollUnits: 'percent',
gtm.scrollDirection: 'vertical'
}
The gtm.scrollThreshold operates in a single-directional manner. For example, if you define a scroll depth of 10%, the trigger will activate only once, and upon subsequent appearances of the same depth, the trigger will not be reactivated.
Element Visibility
When selecting Element Visibility as the Trigger Type, the element to be triggered is defined via its Identity (ID) or CSS Selector (Class). Then, the relevant definition is entered in the Element Selector section, and the trigger’s activation time is determined accordingly.
The On Page Load (Once) setting will trigger the action only once when the element becomes visible. The Per Element (Once) setting will trigger the action for each instance if multiple CSS selectors (classes) are defined. For example, in cases such as list displays, accordions, and tab components. If the Every Time Element Appears setting is selected, the trigger will activate every time the element appears on the screen, regardless of page boundaries. For instance, a banner ad, form, chat box, or a significant section within a text can serve as an example. Additionally, under the Advanced option, the minimum visibility percentage for the element can be defined. Furthermore, options for observing the minimum screen duration (how long the element must remain visible on screen before the trigger activates) and DOM changes can be used to provide detailed insights into the visibility process.
YouTube videos can be associated with events by default. Start, completion, pause, search, and playback, as well as progress status (which can be defined with multiple values, including percentage and time stamps in seconds) can be triggered as events and used as triggers. For example, viewing the entire ad video can be defined as a conversion.
The relevant event supports YouTube videos directly. The trigger activates only on YouTube videos that have JavaScript API support (e.g., required query parameters). When the option Enable JavaScript API support for all YouTube videos is selected, missing parameters will be added to all YouTube videos on the page.
GTM and GTAG Event and Conversion Actions
When the relevant events are defined as Google Analytics events (GTM > Tags > New > Google Analytics – Universal Analytics > Event Type > *Event_), they can be tracked under Google Analytics > Behavior > Events.
Additionally, these actions can be evaluated as triggers for various purposes (conversion, triggering another event, etc.) within GTM. These operations, of course, must be performed manually within GTAG. Therefore, I recommend executing these actions via GTM. Naturally, these actions can also be integrated with Google Analytics Goals and E-commerce events, as well as Facebook Pixel Events.