One area where beginners 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 nigeria phone number resource Google Tag Manager (GTM) custom JavaScript to trigger tags under specific conditions in cases like the one above.

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.