Advanced and Custom tags implementation

Last updated on
25 September 2018

Creating custom Tealium iQ Tags and Groups

It is possible for custom modules to implement their own Tealium iQ Tags (fields) and Groups (see field plugin example)

Creating custom Tealium iQ Group

Example:
https://cgit.drupalcode.org/tealiumiq/tree/src/Plugin/tealium/Group/Page...

namespace Drupal\tealiumiq\Plugin\tealium\Group;

/**
 * The page group.
 *
 * @TealiumiqGroup(
 *   id = "page",
 *   label = @Translation("Page tags"),
 *   description = @Translation("Page tags."),
 *   weight = 1
 * )
 */
class Page extends GroupBase {
  // Inherits everything from Base.
}

Creating custom Tealium iQ Tags

Example: https://cgit.drupalcode.org/tealiumiq/tree/src/Plugin/tealium/Tag/PageNa...

namespace Drupal\tealiumiq\Plugin\tealium\Tag;

/**
 * The basic "Page Name" tealium tag.
 *
 * @TealiumiqTag(
 *   id = "page_name",
 *   label = @Translation("Page Name"),
 *   description = @Translation("Page Name."),
 *   name = "page_name",
 *   group = "page",
 *   weight = 4,
 *   type = "label",
 *   secure = FALSE,
 *   multiple = FALSE
 * )
 */
class PageName extends TagBase {
  // Nothing here yet. Just a placeholder class for a plugin.
}

Creating custom Tealium iQ Tags Event Subscribers

Example https://cgit.drupalcode.org/tealiumiq/tree/src/EventSubscriber/AlterUdoP...

  /**
   * Alter the UDO.
   *
   * @param \Drupal\tealiumiq\Event\AlterUdoPropertiesEvent $event
   *   Alter Udo Properties Event.
   */
  public function doAlterUdoProperties(AlterUdoPropertiesEvent $event) {
    // Example.
    $properties = $event->getProperties();
    $properties['custom_var'] = '[current-page:title]';
    $event->setProperties($properties);
  }

Help improve this page

Page status: No known problems

You can: