Hybris Integration

This article describes how to configure the Hybris Integration Tag.

Prerequisites

  • A Tealium IQ account.
  • hybris v5.0.1+ extracted and built, including the B2C Commerce Accelerator.

Definitions

  • Universal Data Object (UDO) = The Data Layer object of key/value pairs.
    This object is generated in the page as the global JavaScript object utag_data. The Tealium utag.js uses utag_data as the base Data Layer for your tags.
  • Tealium Account = The account assigned to your purchase of Tealium iQ.
  • Tealium Profile = The specific web property name for your website.

Installing Addon

Github repo: https://github.com/Tealium/integration-hybris

  1. Place the tealiumiqaddon directory into ${HYBRIS_BIN}/custom. This directory is in the /hybris/bin/custom/ folder in the repo.
  2. Add <extension dir="${HYBRIS_BIN}/custom/tealiumiqaddon"/\> to your config/localextensions.xml.
  3. Add tealiumiqaddon to yacceleratorstorefront by using:
  • sudo ant addoninstall -Daddonnames="tealiumiqaddon"
  • DaddonStorefront.yacceleratorstorefront="yacceleratorstorefront"
  1. Update the following files:
  • For ${HYBRIS_BIN\}/ext-template/yacceleratorstorefront/web/webroot/WEB-INF/tags/desktop/template/master.tag by adding:
    <%@ taglib prefix=“tealiumiqaddon” tagdir="/WEB-INF/tags/addons/tealiumiqaddon/shared/analytics" %> at the top of the file.
    <tealiumiqaddon:sync/> after the <head> tag
    <tealiumiqaddon:tealium/> after the <body> tag
  • For ${HYBRIS_BIN}/custom/tealiumiqaddon/project.properties.template by changing:
    tealiumiqaddon.account,tealiumiqaddon.profile, and tealiumiqaddon.target to your Tealium IQ account-specific information.
    Modify tealiumiqaddon.utagSyncEnabled = 1 if you want to enable utag.sync.js injection into the <head> of your HTML page. This feature is optional and disabled by default.

Adding Custom Data

By default, the add on provides a comprehensive list of standard e-commerce variables. If these default values are not sufficient for your installation, you can extend the default page types as well as create new custom page types.

  1. Create a new class implementing the interface com.tealium.dataconnector.hybris.HybrisDataConverter.HybrisCustomDataConverter and implement all methods of the interface.
package com.tealium.dataconnector.hybris;
import com.tealium.dataconnector.hybris.HybrisDataConverter.HybrisCustomDataConverter;
import com.tealium.dataconnector.hybris.HybrisDataConverter.HybrisCustomPageTypeCustomData;
import com.tealium.util.udohelpers.UDO;
import com.tealium.util.udohelpers.exceptions.UDOUpdateException;
public class TealiumCustomData implements HybrisCustomDataConverter {
	// ... add unimplemented methods of interface.
}
  1. If you are NOT adding values to any of the methods of the interface, make sure to return the udo object.
@Override
public UDO homePage(UDO udo) {
	return udo;
}
  1. To add or modify values to a default page, add to the override method for that page.
@Override
public UDO searchPage(UDO udo) {
	try {
		udo.setValue("page_name", "new search page name");
		udo.setValue("custom_key", "custom_value");
		} catch (UDOUpdateException e) {
			e.printStackTrace();
	    }
		return udo;
	 }
  1. To add a new page type with values, add a static variable to your class and add new pages to the addCustomPages method:
public class TealiumCustomData implements HybrisCustomDataConverter {
private static Map<String, HybrisCustomPageTypeCustomData> customPagesMap;
@Override
public Map<String, HybrisCustomPageTypeCustomData> getHybrisCustomPageTypes() {
	return customPagesMap;
}
//... other methods
@Override
public void addCustomPages() {
	if (customPagesMap == null){
	    customPagesMap = new HashMap<>();
	}
		customPagesMap.put("custom_one", new HybrisCustomPageTypeCustomData(){
	@Override
	public UDO getCustomDataUdo(UDO udo) {
		try {
		     udo.setValue("page_name", "custom page 1");
		     udo.setValue("custom_page1_key", "custom value");
		    } catch (UDOUpdateException e) {
			e.printStackTrace();
		    }
		    return udo;
	        }
	});
	customPagesMap.put("custom_two", new HybrisCustomPageTypeCustomData(){
	@Override
	public UDO getCustomDataUdo(UDO udo) {
		try {
			udo.setValue("page_name", "custom page 2");
			udo.setValue("custom_page2_key", "custom value");
		    } catch (UDOUpdateException e) {
			e.printStackTrace();
		    }
		return udo;
		}
	});
	}
}
  1. Modify:
    ${HYBRIS_BIN\}/custom/tealiumiqaddonweb/webroot/WEB-INF/tags/addons/tealiumiqaddon/shared/analytics/data.tag
  • Replace CLASS_NAME with your class name (for instance, TealiumCustomData)
  • Add your new class: <%@ tag import=“com.tealium.dataconnector.hybris. CLASS_NAME “%>
  • Register the new class with HybrisDataConverter: <%HybrisDataConverter.registerCustomDataClass(“ID”, new CLASS_NAME ()); %>

Finish

Rebuild and restart hybris.

  • sudo ant all
  • sudo ./hybrisserver.sh

Default data sources

All Pages

Source Description
page_name Contains a user-friendly page name
site_region Includes values for region or localized version, for example, en_US
site_currency Contains the currency shown on site, for example, USD
page_type Contains a user-friendly page type, for example, cart page

Search Page

Source Description
search_results Contains the number of results returned with a search query
search_keyword Contains the search query conducted by user

Category Pages

Source Description
page_category_name Contains a user-friendly category name, for example, appliances

Product Page

Source Description
product_id Contains product ID(s); multiple values should be comma-separated
product_sku Contains product SKU(s); multiple values should be comma-separated
product_name Contains product name(s); multiple values should be comma-separated
product_brand Contains product brand(s); multiple values should be comma-separated
product_category Contains product category(s); multiple values should be comma-separated
product_subcategory Contains product subcategory(s); multiple values should be comma-separated
product_unit_price Contains product unit price(s); multiple values should be comma-separated

Cart Page

Source Description
product_id Contains product ID(s); multiple values should be comma-separated
product_sku Contains product SKU(s); multiple values should be comma-separated
product_name Contains product name(s); multiple values should be comma-separated
product_brand Contains product brand(s); multiple values should be comma-separated
product_category Contains product category(s); multiple values should be comma-separated
product_subcategory Contains product subcategory(s); multiple values should be comma-separated
product_unit_price Contains product unit price(s); multiple values should be comma-separated
product_quantity Contains product quantity(s); multiple values should be comma-separated

Order Confirmation

Source Description
order_id Contains the order or transaction ID
order_subtotal Contains the order payment type
order_payment_type Contains the order payment type
order_total Contains the order total value
order_discount Contains the order discount (if any)
order_shipping Contains the order shipping value
order_tax Contains the order tax amount
order_currency Contains the currency associated with the transaction, for example, USD'
order_coupon_code Contains the order coupon code
order_type Contains the order/cart
product_id Contains product ID(s); multiple values should be comma-separated
product_sku Contains product SKU(s); multiple values should be comma-separated
product_name Contains product name(s); multiple values should be comma-separated
product_brand Contains product brand(s); multiple values should be comma-separated
product_category Contains product category(s); multiple values should be comma-separated
product_subcategory Contains product subcategory(s); multiple values should be comma-separated
product_unit_price Contains product unit price(s); multiple values should be comma-separated
product_quantity Contains product quantity(s); multiple values should be comma-separated
customer_email Contains the customer email

Customer Info Page

Source Description
customer_name Contains the customer username
customer_email Contains the customer email
gender Contains the customer gender based on salutation

Was this page helpful?

This page was last updated: May 16, 2016