The short video market is heating up According to app rankings released by research company Apptopia, TikTok was the mos

Taiwan Data Forum trends and innovations
Post Reply
mehadihasan123
Posts: 217
Joined: Wed Dec 11, 2024 4:52 am

The short video market is heating up According to app rankings released by research company Apptopia, TikTok was the mos

Post by mehadihasan123 »

In today's ad operations, it is common to use the platform's automatic bidding function. Designing micro-conversions and negative conversions has also become an important part of the ad manager's job, and the use of tag management tools has also increased.

One area where beginners norway phone number resource to tag management often get stuck is when they cannot use a URL as a trigger condition .

This time, we will introduce a way to use Google Tag Manager (GTM) custom JavaScript to trigger tags under specific conditions in cases like the one above.

Image

>>Download the document set (service documents and case studies) to learn about Ollie's

Table of Contents [ Hide ]

What is GTM Custom JavaScript?
Variable design for each case - Tag implementation
Case 1: A multi-product e-commerce site promoting only one product
Case 2: A human resources service that aims to register members, where the outcome definition is only those who hold certain qualifications
What is GTM Custom JavaScript?
This is a type of "user-defined variable" that obtains the value of a specified variable, and is a function that literally allows you to use original JavaScript.

When you select "Variable type: Custom JavaScript" on the user-defined variable editing screen, a free form will be displayed where you can write any JavaScript you like.


Custom JavaScript must be in the form of an anonymous function that returns a value , so your JavaScript must start with "function(){" and end with "}", and the function must return a value in the form "return ○○".

Reference: User-defined variable types for the Web

For example, if you want to return the value 100 using custom JavaScript, you would write it like this:

function(){
return 100;
}
The advantage of custom JavaScript is that it allows you to retrieve page elements with great flexibility . However, because of this high degree of freedom, it requires knowledge of JavaScript that allows you to design it while taking into account the specifications of the website.

Variable design for each case - Tag implementation
Below, we will introduce how to design variables and implement tags using custom JavaScript for two cases.

Case 1: A multi-product e-commerce site promoting only one product
Requirements
I want the CV tag to fire only when a specific product (product A) is purchased.
The CV tag should fire on the purchase completion page (however, the URL cannot be specified)
There are three main things we need to do:

Find a page element on the purchase completion page that identifies product A
Create a variable to capture the page element at the time of purchase
Implement the variable in GTM
First, open the Google Chrome Developer Tools (hereinafter referred to as Developer Tools) and look for elements on the purchase completion page that can identify Product A.
Post Reply