I’ve tried to refer to different contexts in which the user behavior tracking on our website and/or application, facilitated by the Google Tag Manager tool, is being performed.
Additionally, I’ve illustrated the topics of Google Ads account creation and conversion setup and Google Ads Conversion Code Installation in the processes of tracking and evaluating visitors’/users’ activities such as page views, form submissions, and clicks. In this article, I’ll take a step-by-step approach to explain the entire process as simply and clearly as possible.
In the following example, I’ll use the WordPress website I set up via DigitalOcean. My Google Ads and Google Tag Manager accounts are already configured. For more information regarding the installations, please refer to the following articles:
Now, let’s briefly define the term conversion.
Conversion
IMPORTANT RULES:
- Maintain the original formatting (markdown, HTML tags, links, etc.)
- Keep technical terms and proper nouns as appropriate
- Preserve code blocks and technical syntax exactly
- Maintain the same tone and style
- Only output the translated text, no explanations or comments
In time, I will provide more in-depth explanations on topics such as conversion optimization and others. However, if a brief summary is needed, conversion refers to the scenario where a user completes the intended action on a web page or within a web/mobility application. For example, on a content website, actions such as user registration, viewing specific pages, spending a certain amount of time on those pages, or browsing a defined number of pages could count as conversions. For an e-commerce site, of course, a purchase would be considered a conversion. In a real estate project, form submissions or phone call requests made via the landing page would count as conversions, or for a game, level progression or in-app purchases could also be considered conversions. The key objective is that a valuable action must be completed by the user.
We must also differentiate macro conversions and micro conversions within conversion tracking. A macro conversion represents our primary goal, while micro conversions identify the individual steps completed during the process of achieving that primary goal. To illustrate with an e-commerce example, viewing a product page, adding a product to the cart, and entering shipping and payment details are all considered micro conversions. This is because the user can exit at any of these steps. A macro conversion, on the other hand, occurs after all these steps are completed—specifically, when the payment is finalized.
In this article, I will examine two conversion scenarios. The first one will track the conversion triggered by the submission of the CF7 form, with the conversion event occurring upon redirection to the thank-you page. For this purpose, the conversion code should be defined as a page view. The second conversion will be linked to a link click. In the example, I used a phone number as the trigger for the click. It could also be a file or a button. You can customize these definitions according to your specific needs.
Google Tag Manager Operations
You can create a account or set up a container under an existing account under Google Tag Manager. If you prefer to create a new account, you can define both the account and container on the same page. The next step is to obtain the setup code for the newly created container. You must install this code on our web page in the specified manner. You can use Google Tag Assistant to verify that your installation is working properly.
Google Ads Operations
You may have just created a new Ads account. What’s important is the Tools and Settings section under your account. This is where we will access our conversion and remarketing data. Let’s log in to our Google Ads account and open this section. Under the opened section, you will see the Measurement header, and within it, the Conversions link. By clicking on the Conversions link, we can begin the process of creating a conversion code.
Unless otherwise required, each conversion definition will require its own dedicated conversion code. Without such separation, analyzing conversion actions and implementing appropriate optimizations would become significantly complex. As mentioned at the beginning of the article, within this article’s scope, we will create two conversion codes. You can adjust this number based on your specific needs.
- Page view (
/tesekkurler/page viewed) - Link click (triggered when the phone number link is clicked)
We will use the Website option for both conversion codes.
The Global site tag is a snippet of code that must function across all our pages. In addition, this code snippet also provides the Remarketing feature. The trigger snippet is associated with conversion actions and should be placed after the global site tag, activating only when a conversion as defined is triggered.
The activity snippet has page load and click options. On page load, we’re notified when a page is loaded, while on click, the conversion is processed via a JavaScript function named gtag_report_conversion(). If we had to add the code directly instead of using Google Tag Manager, we would have added the page load code to run on the relevant page, and the JS function gtag_report_conversion() would have been triggered upon clicking the link with the onClick="gtag_report_conversion()" attribute. Importantly, the url argument inside the gtag_report_conversion() function specifies which page the user will be redirected to after clicking. If left blank, the conversion will be processed for the page where the click occurred.
Now, instead of using the code we created, we’ll set up our configurations in Google Tag Manager using the id and label values present in the code.
Google Ads: Remarketing
For this process, we’ll log in to the Container section of our Google Tag Manager account. When we follow the steps Tags > New, a new tag configuration section will open. We can assign any title we prefer. I chose GAds RM. By clicking on the Tag Configuration section, we can access the list of available tag types. First, we’ll set up our remarketing tag. For this, simply select the Google Ads Remarketing option. Then, we’ll need to navigate to the global site tag section we created earlier in our Google Ads account.
<!-- Global site tag (gtag.js) - Google Ads: 940310051 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-940310051"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-123456789');
</script>
The AW-123456789 found in the above code is our Google Ads account identifier. The numeric portion 123456789 is our account conversion ID. Yes, we will add this value to the Conversion ID section within GTM and select the Trigger option for All Pages. After saving this setting, we can proceed to the next step.
Google Ads: Conversion Tracking
As we did in the steps under the Re-targeting section, we will now view the tag options available under our GTM container. This time, we’ll select the Google Ads Conversion Tracking option. The Conversion ID is static and should match the same value found in the remarketing tag; however, the Conversion Tag is specifically created for each conversion code.
When viewing the code sent to you as a conversion trigger, you will see that the send_to parameter has a value in the format AW-123456789/mliHCKi94soBEKP8r8AD. The 123456789 portion is a static value, while the value following the / — mliHCKi94soBEKP8r8AD — is specifically generated for the conversion tag definition.
We will enter the numeric value following AW into the Conversion ID field and the unique value into the Conversion Tag field. For the trigger section, we will create a different definition. If we select the All Pages definition, our conversion code will run across all pages, which would result in a faulty setup and would not accurately reflect the correct conversion values. Therefore, we must create a specific page-based definition. For example, the thank-you page that users are redirected to after form submission, or the payment result page displayed after a purchase is completed. Additionally, it is preferable that these pages do not load directly. This way, you can prevent users from repeatedly viewing these pages through search engine results or browser history.
Yes, for our specific page definition, Trigger > New Trigger > Trigger Configuration > Page Viewing > Some Page Viewings > Page Path includes the path tesekkurler, and simply following this path and saving the trigger is sufficient. Our conversion code will now trigger only when the /tesekkurler/ page is viewed.
For link clicks, we simply follow the same conversion tracking steps, specifically Only Links > Some Link Clicks > Click Text (or Click URL) including the step Phone Number,.
CF7 Redirection
In my article titled Contact Form 7 Conversion Setup, I discussed how the form submission can be tracked using a DOM event. The redirection process can also be addressed similarly, following the same steps outlined in that article. I’ll provide a more detailed explanation on the topic of CF7 redirection in a separate article. For now, I’m sharing an example code below.
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'http://alanadi.com/tesekkurler/';
}, false );
Yes, that’s all for now. Please feel free to add any issues you encounter or topics that come to mind in the comments.