Build a secure user interface for custom code tags.
In the left menu of GTM go to Templates and then click on New at the tag template section.
Choose a name for the template and a description. You can also include an image to display as an icon for the template, in the list of tags.
Depending on the tag you are creating, you have different types of fields to add. If you want a field where the user can write a value, choose Text input, or if you want the user to select within a list of values, you can use a Drop-down menu.
Each type of field has a specific configuration, once added you’ll be able to set the field up.
require() it in the template code. For example, creating a variable:
setInWindow = require('setInWindow');
Permissions are automatically detected while using APIs on the code. Once you’ve created the code of the tag and call all the APIs, you have to set the type of permissions needed for them to work, If you skip this step the code won’t work.
Go to the list of tags, and you’ll find the new tag you’ve created. When setting up the tag, it will need you to type or choose the parameters you decided necessary to work. For example, if you created a tag template for the Facebook Pixel, you may have the following structure: