This article describes how to manage tag templates and how to update to the latest version of vendor tag templates.

In this article:

Prerequisites

How it Works

What is a tag template?

Tag templates contain JavaScript code used to run vendor tags. Each tag has its own template that converts the tag configuration, data mappings, and extensions from the iQ Tag Management (TiQ) interface into JavaScript code that runs on your site.

How can I use tag templates?

There are a number of scenarios where you might need to use a tag template, including:

  • Updating to a newer version of a tag
  • Customizing the core functionality of a tag
  • Fixing a bug in a tag

Some customizations and fixes can be achieved using an extension scoped to the tag. This approach should be explored first because it is easier to maintain and integrate into the publish workflow.

Do I need to update?

Tag vendors are constantly updating their technologies. When a vendor releases a major update to their tag, the tag marketplace is also be updated to ensure that you can take advantage of the new features offered. To check the status of your tags to determine if you need to update, use the Tag Status Checker.

Is it safe to update?

If a tag template has not been altered, the Tag Status Checker indicates this by using a green dot symbol, indicating not customized, as shown in the following example:
TagStatusChecker1.png
Tag template updates are safe options for tag templates that are not customized. However, when a tag template is customized, the customizations are not carried over to the updated tag template. An evaluation is required for custom tags, which is outside of the scope of this article, to determine if the customized code needs to be applied to the upgraded tag template.

Version Template vs. Profile Template

In the edit template screen there are two options to choose from when saving your changes: Save Version Template and Save Profile Template. It is important to understand the difference between these two options so that you can avoid accidentally publishing code.

In both options, saving changes to a tag template occurs immediately and does not require the profile to be saved.

tag-templates-version-vs-profile.png

Profile Template

A profile template is the default template for a tag in your iQ profile. Changes to the profile template exist in all versions of the profile. Changes are made to the profile template by clicking Save Profile Template in the tag template window. Regardless of which version of the profile you are in when you click Save Profile Template, the next time the profile is published it will include the modified tag template. If a version template already exists, the profile template is ignored.

The profile template is identified in the edit template dialog with the suffix "(Profile)" in the name, as shown in the following example.

TemplateConfigProfileSelection.png

Version Template

A version template is a second, higher precedent version of the tag template. If a profile version contains a version template, it takes precedence over the profile template when the profile is published. Changes to the version template will only exist in the current version of the profile. Create and make changes to the version template by clicking Save Version Template in the tag template window. Once you create a version template, all subsequent profile versions will also have a version template.

The version template is identified in the edit template screen with the suffix "(Version)" in the name.

The version template is the safest option when making tag template changes because it allows you to revert to a previous version of the template.

How do I update to the latest marketplace version?

In order to update a tag template to the latest version offered in the tag marketplace, enter the tag template edit dialog and click the trash icon. This is called "dropping" the template. It deletes the current template and replaces it with the most current template from the marketplace. This action of "dropping" a template can also be used to revert a customized template back to the original.

Tag Template Scenarios

The following table illustrates the state of the profile and version templates across versions and publishes of a profile.

Profile Version Profile Template (PT) Version Template (VT) Publish
Version 04 PT-1.0 VT-1.1 VT-1.1
Version 03 PT-1.0 VT-1.0 VT-1.0
Version 02 PT-1.0 VT-1.0 VT-1.0
Version 01 PT-1.0 n/a PT-1.0

This table reflects the following sequence of actions:

  1. In "Version 01", do a Save as to create "Version 02".
  2. In "Version 02", edit a tag template and do a Save Version Template to create "VT-1.0".
  3. In "Version 02", Save and Publish.
    Template "VT-1.0" takes precedence and is published.
  4. In "Version 02", do a Save as to create "Version 03".
    Notice that version template "VT-1.0" is carried forward to the new profile version.
  5. In "Version 03", do a Save as to create "Version 04".
  6. In "Version 04", edit "VT-1.0" and click Save Version Template to create "VT-1.1".
  7. In "Version 04", Save and Publish.
    Template "VT-1.1" takes precedence and is published.

The following table shows potential actions you could take from this point and what the results would be.

Action Result
In "Version 04", edit the profile template and click Save Profile Template to create "PT-1.1
  • The updated profile template, "PT-1.1", will be accessible from any version of the profile.
  • Only a publish from "Version 01" would result in "PT-1.1" being published.
In "Version 04", drop the version template and Save and Publish
  • Version template "VT-1.1" would be deleted and "Version 04" would no longer have a version template.
  • The published template would be "PT-1.0". Previous versions, "Version 03" and "Version 02", would still have a version template.

Updating a Tag Template

In this workflow, you will do the following:

  1. Introduce a version template to your profile,.
  2. Copy the existing profile template content into a version template to keep it as a backup.
  3. Drop the profile template to get the latest marketplace version.
  4. Copy its contents into a second version template for testing.

The following table illustrates the expected state of your profile and templates upon completing these steps.

Profile Version Profile Template (PT) Version Template (VT) Publish
Version 03 AdWords New AdWords New AdWords New
Version 02 AdWords New AdWords Orig AdWords Orig
Version 01 AdWords New n/a AdWords Orig

Create a backup of the current tag template in the marketplace Version template

Use the following steps to update a tag template to the latest marketplace version and retain a backup copy of the original tag template:

  1. Go to the Tags screen, find the tag to update, and click Edit Template. (Learn more.)
    tagslist1.png
  2. Click Save Version Template and then click Close.
  3. Perform a "Save as" to publish the profile.
  4. Enter a title and description to identify the template update, such as "Backup tag template - Google Adwords".
  5. Result:
    Profile Version Profile Template (PT) Version Template (VT) Publish
    Version 02 AdWords Orig AdWords Orig AdWords Orig
    Version 01 AdWords Orig n/a AdWords Orig

Drop the Profile template to get the latest marketplace version

  1. Go to the Tags screen, find the tag to update, and click Edit Template.
  2. In the pop-up window, select the profile template.
  3. Click the trash icon (1) and click Yes (2) to confirm the action.

    Do not click Save Version Template or Save Profile Template during this step.

    DropTemplate2.png
  4. Click Close.
  5. Perform a "Save as" and publish.
  6. Enter a title and description to identify the template update, such as, "Upgrade tag template - Google Adwords":
    SaveTaginProfile.png
  7. Result:
    Profile Version Profile Template (PT) Version Template (VT) Publish
    Version 03 AdWords New AdWords Orig AdWords Orig
    Version 02 AdWords New AdWords Orig AdWords Orig
    Version 01 AdWords New n/a AdWords Orig

Save the new Profile template into the Version template

  1. Go to the Tags screen, find the tag to update, and click Edit Template.
  2. In the pop-up window, select the profile template.
  3. Click Save Version Template.
  4. Click Close.
  5. Perform a "Save" and publish.
  6. At this point the version template will be used.
    The resulting new template is in "Version 03" and the older template is in "Version 02".
    Profile Version Profile Template (PT) Version Template (VT) Publish
    Version 03 AdWords New AdWords New AdWords New
    Version 02 AdWords New AdWords Orig AdWords Orig
    Version 01 AdWords New n/a AdWords Orig

Return to a previous version of the template (Revert to a previous Version template)

  1. Open the Version tab.
  2. Identify the previous version with the original tag template and switch to that version.
    VersionsForBackup.png
  3. Go to the Tags screen, find the tag to update, and click Edit Template.
  4. In the pop-up window, select the version template.
  5. Use Select All (PC: CTRL+A, Mac: CMD+A) and Copy (PC: CTRL+C, Mac: CMD+C) to copy the tag template contents from the window into the paste buffer.
  6. Click Close.
  7. Click the Switch to the latest version link to reopen the latest published version.
    SwtichtoLatestPublishedVersion.png

     

  8. Go to the Tags screen, find the tag to update, and click Edit Template.

  9. In the pop-up window, select the version template.
  10. Use Select All and Paste (PC: CTRL+V, Mac: CMD+V) to paste the contents of your paste buffer into the window to update the contents of the tag template.
  11. Click Save Version Template.
  12. Click Close.
  13. Save and publish the profile with a title and description to identify that you have returned to a back-up version of the tag template.
  14. The original tag template, saved as the version template in "Version 02", has been copied and pasted into the version template of "Version 03" and republished.
    Profile Version Profile Template (PT) Version Template (VT) Publish
    Version 03 AdWords New AdWords Orig AdWords Orig
    Version 02 AdWords New AdWords Orig AdWords Orig
    Version 01 AdWords New n/a AdWords Orig