



//<!--
/* <![CDATA[ */

(function($, _window, _document){
	if (!_window.MMS) {
		_window.MMS = {};
	}

	var MMS = _window.MMS;

	MMS.Econda = {};

	MMS.Econda.trackingEvent = null;
	MMS.Econda.additionalTargets = [];
	MMS.Econda.disableTracking = false;
	MMS.Econda.doNotTrack = false;
	MMS.Econda.permissionsProfileState = null;
	MMS.Econda.loadedEventTriggered = false;

	MMS.Econda.lib = {};

	MMS.Econda.lib.getSiteType = function() {
		var siteType = null;
		var bandName = PageContext.get('global.constants.brand.name');
		if (bandName == 'soliver') {
			siteType = [[SOLI.getCurrentBreakpoint()]];
		} else if (bandName == 'triangle') {
			siteType = [[FG.getCurrentBreakpoint()]];
		} else {
			if (PageContext.get('global.isMobileDevice') != undefined && PageContext.get('global.isMobileDevice')) {
				siteType = [['Mobile']];
			} else {
				siteType = [['Desktop']];
			}
		}
		return siteType;
	};

	MMS.Econda.lib.setNavTrackingData = function(pageContext) {
		try {
			var tmpAddInfo = null;
			// read cookie
			var trackNavCookie = CookieUtils.readJSONCookie('trackNav');
			if( typeof trackNavCookie != 'undefined' ) {
				tmpAddInfo = [[pageContext.global.pageType, trackNavCookie.pagetypePrevious, trackNavCookie.navigationElement]];
			} else {
				tmpAddInfo = [[pageContext.global.pageType, 'unknown', 'unknown']];
				trackNavCookie = {};
			}
			// set/update the trackNav-Cookie with the currently known values; this may be overwritten by the click handler
			trackNavCookie.pagetypePrevious = PageContext.getFirst().global.pageType;
			trackNavCookie.navigationElement = 'unknown';
			CookieUtils.createCookie('trackNav', trackNavCookie);
			return tmpAddInfo;
		} catch (e) {
			AppLog.error('Econda Tracking: ', e);
		}
	};

	MMS.Econda.lib.getProductOrigin = function(product) {
		var productData = { 'pid' : product.masterId, 'color' : product.colorCode, 'size' : product.size};
		var trackingInformation = MMS.Tracking.getProductOrigin(productData);
		return trackingInformation;
	};

	MMS.Econda.lib.getViewType = function(product, pageType) {
		var viewType = '';

		var trackingInformation = product.trackingInformation;
		var isProductSetProduct = product.isProductSetProduct;
		var isProductSet 		= product.isProductSet;
		var isQuickview = false;
		if (pageType == 'productquickview') {
			isQuickview = true;
		}

		if(pageType.indexOf('giftcard') == 0) {
			return 'NULL';
		}

		if(pageType == 'cocartremoveproduct' || pageType == 'myaccountwishlistremove') {
			return null;
		}

		var productViewTypePart = '';
		var renderingViewTypePart = '';

		if(trackingInformation != undefined && trackingInformation.renderingType != undefined) {
			if (trackingInformation.productType != undefined && trackingInformation.productType == 'productsetproduct') {
				isProductSetProduct = true;
				isProductSet = false;
			}

			// set productViewType stl or spv
			if (isProductSet || isProductSetProduct) {
				productViewTypePart = 'stl';
			} else {
				productViewTypePart = 'spv';
			}

			// set renderingViewType
			if(trackingInformation.renderingType == 'layer') {
				renderingViewTypePart = 'QV';
			} else if(trackingInformation.renderingType == 'page') {
				renderingViewTypePart = 'Page';
			} else if (trackingInformation.renderingType == 'CartPage') {
				productViewTypePart = 'CartPage';
				renderingViewTypePart = '';
			} else if (trackingInformation.renderingType == 'ovAdd2Cart') {
				productViewTypePart = 'OV';
				renderingViewTypePart = '';
			} else if (trackingInformation.renderingType == 'wishlistInclude') {
				productViewTypePart = 'Wishlist-Slider on Cart Page';
				renderingViewTypePart = '';
			} else if (trackingInformation.renderingType == 'wishlistLayer') {
				productViewTypePart = 'Wishlist-Layer';
				renderingViewTypePart = '';
			} else if (trackingInformation.renderingType == 'wishlistPage') {
				productViewTypePart = 'Wishlist-Page';
				renderingViewTypePart = '';
			} else if (trackingInformation.renderingType == 'restoreCart') {
				productViewTypePart = 'restoreCart';
				renderingViewTypePart = '';
			} else {
				renderingViewTypePart = 'Page';
			}
			viewType = productViewTypePart + renderingViewTypePart;
		}
		// page view product and product set
		else {
			// set productViewType stl or spv
			if (isProductSet || isProductSetProduct) {
				productViewTypePart = 'stl';
			} else {
				productViewTypePart = 'spv';
			}
			if (isProductSet || isProductSetProduct) {
				if (isQuickview) {
					viewType = 'stlQV';
				} else {
					viewType = 'stlPage';
				}
			} else {
				if (isQuickview) {
					viewType = 'spvQV';
				} else {
					viewType = 'spvPage';
				}
			}
		}
		return viewType;
	};

	MMS.Econda.lib.createEcEvent = function(pageContext, product, trackingEvent, type, viewType) {
		var tempProduct = new Object();

		// type
		tempProduct.type = type;

		// pid
		tempProduct.pid  = product.masterId;

		// name
		tempProduct.name = product.name;

		// sku
		if (product.colorCode != '') {
			tempProduct.sku	= product.masterId + '.' + product.colorCode;
		} else {
			tempProduct.sku	= product.masterId + '.NULL';
		}

		// price
		if (product.netPrice != undefined) {
			tempProduct.price = product.netPrice.eurValue;
		} else {
			tempProduct.price = '';
		}

		// group
		tempProduct.group = product.categoryPath;

		// count
		tempProduct.count = product.quantity.toString();

		// color
		if (product.colorCode != '') {
			tempProduct.var1 = product.colorCode;
		} else {
			tempProduct.var1 = 'NULL';
		}

		// size
		if (product.size != '') {
			tempProduct.var2 = product.size;
		} else {
			tempProduct.var2 = 'NULL';
		}

		// viewType
		if(viewType != 'undefined' && !empty(viewType)) {
			tempProduct.var3 = viewType;
		}

		if(type == 'wlist_rmv' || type == 'wlist_add') {
			var origin = MMS.Econda.lib.getProductOrigin(product);
			if(origin != null) {
				tempProduct.var3 = origin;
			}
		}
		if(empty(tempProduct.var3)){
			var viewType = MMS.Econda.lib.getViewType(product, pageContext.global.pageType);
			if(viewType != null) {
				tempProduct.var3 = viewType;
			}
		}

		// fitguide use
		if(!empty(product.trackingInformation)) {
			if(!empty(product.trackingInformation.fitguideUse)) {
				var fitguideUse = product.trackingInformation.fitguideUse; // used|not used|error
				if(fitguideUse == 'error') {
					fitguideUse = 'not supported';
				}
				tempProduct.var4 = fitguideUse;
			} else {
				tempProduct.var4 = 'not used';
			}
		}

		// video tracking
		if(product.hasVideo){
			tempProduct.var5 = 'video available';
		} else {
			tempProduct.var5 = 'video not available';
		}

		// sorting rule
		if (PageContext.get('global.constants.catalog.listingPageGridControlsEnabled')) {
			if(PageContext.get('category.id') != null) {
				tempProduct.var6 = PageContext.get('category.sortingRule');
			} else if(!empty(product.trackingInformation) && !empty(product.trackingInformation.sortingRule)) {
				tempProduct.var6 = product.trackingInformation.sortingRule;
			} else if(!empty(product.categorySortingRule)) {
				tempProduct.var6 = product.categorySortingRule;
			}
		}

		// net list price
		if (typeof product.netListPrice != 'undefined' && product.netListPrice.eurValue != 'N/A') {
			tempProduct.var7 = product.netListPrice.eurValue;
		} else {
			tempProduct.var7 = 'NULL';
		}

		// product gender
		tempProduct.var8 = MMS.Econda.lib.getProductGender(product);

		// productGroup
		if(!empty(product.sapMainClass) && !empty(product.sapClass) && !empty(product.sapSubClass)) {
			tempProduct.var9 = product.sapMainClass + '-' + product.sapClass + '-' + product.sapSubClass;
		} else {
			tempProduct.var9 = 'NULL';
		}

		// segment
		if (product.segment != '') {
			tempProduct.var10 = product.segment;
		} else {
			tempProduct.var10 = 'NULL';
		}
		// brand
		if(!empty(product.trackingInformation) && !empty(product.trackingInformation.brandName)) {
			tempProduct.var11 = product.trackingInformation.brandName;
		} else {
			tempProduct.var11 = PageContext.get('global.constants.brand.name');
		}

		// add ec_Event
		if(trackingEvent.ec_Event == undefined) {
			trackingEvent.ec_Event = new Array();
		}
		trackingEvent.ec_Event.push(tempProduct);

		return trackingEvent;
	};

	MMS.Econda.lib.getProductGender = function(product) {
		var productGender = null;
		switch (product.mainCategoryId) {
			case 'men':
				productGender = 'Herren';
				break;
			case 'junior':
				productGender = 'Junior';
				break;
			default:
				productGender = 'Damen';
				break;
		}
		return productGender;
	};

	MMS.Econda.lib.addAdditionTarget = function(target) {
		MMS.Econda.additionalTargets.push(target);
	};

	MMS.Econda.lib.anonymizeTrackingEvent = function(pageContext) {
		delete MMS.Econda.trackingEvent.newsuid;
		delete MMS.Econda.trackingEvent.hashedvalue;
		delete MMS.Econda.trackingEvent.register;
		delete MMS.Econda.trackingEvent.login;

		if(typeof(MMS.Econda.trackingEvent.billing) != 'undefined') {
			// orderNo
			MMS.Econda.trackingEvent.billing[0] = pageContext.order.orderNoHashed;
			// customerNo
			MMS.Econda.trackingEvent.billing[1] = 'null';
			// billingAddress
			MMS.Econda.trackingEvent.billing[2] = 'null';
			// birthday
			MMS.Econda.trackingEvent.billing[6] = 'null';
			// salutation
			MMS.Econda.trackingEvent.billing[7] = 'null';
			// shippingAddress
			MMS.Econda.trackingEvent.billing[8] = 'null';
			// customer level
			MMS.Econda.trackingEvent.billing[9] = 'null';
			// sum of net list prices
			MMS.Econda.trackingEvent.billing[13] = 'null';
		}
	};

	MMS.Econda.lib.setGlobalCustomerData = function(pageContext)
	{
		// newsuid
		if(PageContext.get('customer.newsletter.inxmailRecipientId') != null) {
			MMS.Econda.trackingEvent.newsuid = PageContext.get('customer.newsletter.inxmailRecipientId');
		}
		// hashed mail
		if(PageContext.get('customer.hashedMail') != null) {
			MMS.Econda.trackingEvent.hashedvalue = PageContext.get('customer.hashedMail');
		}
		// ab test
		var abTestId = PageContext.get('customer.abTestSegment.abTestId');
		var segmentId = PageContext.get('customer.abTestSegment.segmentId');
		var dwAbTest = null;
		if (abTestId != null && segmentId != null) {
			dwAbTest = [abTestId,segmentId];
		}
		if (dwAbTest != null) {
			var abTest = [];
			if (dwAbTest != null) {
				abTest.push(dwAbTest);
			}
			MMS.Econda.trackingEvent.abtest = abTest;
		}

		// register
		if(pageContext.customer.registerMarker) {
			MMS.Econda.trackingEvent.register = [[pageContext.customer.customerNoHashed, pageContext.customer.registerStatus]];
		}

		// login
		if(pageContext.customer.loginMarker) {
			MMS.Econda.trackingEvent.login = [[pageContext.customer.customerNoHashed, pageContext.customer.loginStatus]];
		}
	};

	MMS.Econda.lib.setCheckoutset = function(pageContext, trackingEvent)
	{
		// checkoutset
		if (pageContext.checkoutFlags != undefined && pageContext.checkoutFlags.expressInitialEnabled != undefined && pageContext.checkoutFlags.expressInitialEnabled == true) {
			trackingEvent.checkoutset = [['Express Checkout V2']];
		} else {
			trackingEvent.checkoutset = [['Normal Checkout V2']];
		}
		return trackingEvent;
	};

	// ******************************************************************************
	// pageType
	// ******************************************************************************

	MMS.Econda.pageType = {};

	// *************
	// home
	// *************
	MMS.Econda.pageType.home = function(pageContext) {
		if (PageContext.get('global.constants.departmentTargeting.redirectEnabled')) {
			return new MMS.Econda.TrackingEvent(pageContext, 'Homepage/Switch');
		} else {
			return new MMS.Econda.TrackingEvent(pageContext, 'Homepage');
		}
	};

	// *************
	// department
	// *************
	MMS.Econda.pageType.department = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Homepage/' + PageContext.get('topcategory.displayName'));
	};

	// *************
	// page
	// *************
	MMS.Econda.pageType.page = function(pageContext) {
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, pageContext.global.pageTitle);
		if (pageContext.content.name != undefined && pageContext.content.name != '') {
			trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Customer Service/' + pageContext.content.name);
		}
		return trackingEvent;
	};

	// *************
	// errorpage
	// *************
	MMS.Econda.pageType.errorpage = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext,'404' + window.location.pathname);
	};

	// *************
	// newsletter
	// *************
	MMS.Econda.pageType.newsletter = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Newsletter');
	};

	// *************
	// contactform
	// *************
	MMS.Econda.pageType.contactform = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Kontaktformular');
	};

	// *************
	// contactform
	// *************
	MMS.Econda.pageType.loginmodal = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Relogin Modal');
	};

	// *************
	// productsearch
	// *************
	MMS.Econda.pageType.productsearch = function(pageContext) {
		var content = 'Product Search';
		var topcategory = PageContext.get('topcategory.id');
		var category	= PageContext.get('category.id');

		// set content - add category path if cat refined
		if(topcategory != category) {
			content += '/' + PageContext.get('category.path');
		}

		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext,content);
		var search = [[pageContext.search.searchPhrase, parseInt(pageContext.search.count)]];

		// autofilter
		var isAutofilterSearch = false;
		var autofilterParameterValue = pageContext.global.urlParameter.autofilter;
		if(!empty(autofilterParameterValue)) {
			var targetName = 'Auto Filter ' + decodeURIComponent(autofilterParameterValue);
			MMS.Econda.lib.addAdditionTarget(['Onsite Search', targetName, '1', 'a']);
			isAutofilterSearch = true;
		}

		// refinements
		var isRefinementSearch = false;
		if(pageContext.search.refine != undefined) {
			var sfilter = [];
			jQuery.each(pageContext.search.refine,function(refinementKey,refinementValues) {
				if(refinementKey != 'cgid') {
					isRefinementSearch = true;
					sfilter.push(new Array(refinementKey,refinementValues.join('|')));
				}
			});
			if (sfilter.length > 0) {
				trackingEvent.sfilter = sfilter;
			}
		}

		// search
		if (search != undefined && search != null && (isRefinementSearch == false || isAutofilterSearch == true)) {
			trackingEvent.search = search;
		}

		return trackingEvent;
	};

	// *************
	// categoryshow
	// *************
	MMS.Econda.pageType.categoryshow = function(pageContext) {
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Catalog/' + PageContext.get("category.path"));
		// refinements
		var isRefinementSearch = false;
		if(pageContext.search.refine != undefined) {
			var sfilter = [];
			jQuery.each(pageContext.search.refine,function(refinementKey,refinementValues) {
				isRefinementSearch = true;
				if(refinementKey == 'cgid') {
					if (!empty(pageContext.search.searchPhrase)) {
						sfilter.push(new Array('search',pageContext.search.searchPhrase));
					}
				} else {
					sfilter.push(new Array(refinementKey,refinementValues.join('|')));
				}
			});
			if (sfilter.length > 0) {
				trackingEvent.sfilter = sfilter;
			}
		}
		// cattrack
		var cattrack = [];
		// set catGrit to fixed value
		cattrack.push('Responsive');
		// Model View
		var catView = 'Model';
		if(typeof(pageContext.category.viewOverride) != 'undefined') {
			if(pageContext.category.viewOverride == 'viewProducts') {
				catView = 'Product';
			}
		} else if(CookieUtils.readCookie('ovviewmodel') == 'viewProducts') {
			catView = 'Product';
		}
		cattrack.push(catView);
		// Sorting Rule
		cattrack.push(pageContext.category.sortingRule);
		// add cattrack to trackingEvent
		trackingEvent.cattrack = cattrack;
		return trackingEvent;
	};

	// *************
	// productdetails
	// *************
	MMS.Econda.pageType.productdetails = function(pageContext) {
		var product = pageContext.product;

		// check for variant change (size) - do not track
		if(!product.isProductSet){

			var tmpHistory = PageContext.history;
			var isSamePageType 	= false;
			var isSameMaster	= false;
			var isSameColor		= false;
			var isSameSize		= false;

			for(var i = tmpHistory.length - 1; i >= 0; i--){

				if(tmpHistory[i].product.isProductSet){
					continue; // next history entry
				}

				// leave tracking for size change only
				isSamePageType 	= pageContext.global.pageType == tmpHistory[i].global.pageType; // current page type and history page type are equal
				isSameMaster	= tmpHistory[i].product.masterId == product.masterId; 			// current master and history master are equal
				isSameColor		= tmpHistory[i].product.colorCode == product.colorCode; 		// current color code and history color code are equal
				isSameSize		= tmpHistory[i].product.size == product.size; 					// current size and history size are equal

				if(	isSamePageType && isSameMaster && isSameColor && !isSameSize){
					MMS.Econda.doNotTrack = true;
					return; // leave function without tracking - only on size variant change
				}

				// if history from page type found -> stop
				if(isSamePageType){
					break; // leave - page type to compare was found
				}
			}
		}

		// set content
		var content = 'Catalog/';
		if (product.isProductSetProduct && product.isProductSet != undefined) {
			content += '/' + product.productSet.categoryPath + '/' + product.productSet.name + '-' + product.productSet.id + '/' + product.name + '_' + product.id;
		} else {
			content += product.categoryPath + '/' + product.name + '_' + product.id;
		}
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, content);

		trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pageContext.product, trackingEvent, 'view');

		// video target tracking
		if(product.hasVideo == true){
			jQuery(document).one('spvcontroller:reinitiated', function(event) {
				jQuery(document).find('.jsVideoPlay').val('false');
			});
			// on play video
			jQuery(document).off('spvcontrollervideoplay');
			jQuery(document).on('spvcontrollervideoplay', function(event) {
				// set add2cart hidden field marker true
				jQuery(document).find('.jsVideoPlay').val('true');
				// send target tracking
				var _econdaVideoPlayTarget = new Object();
				_econdaVideoPlayTarget.siteid = trackingEvent.siteid;
				_econdaVideoPlayTarget.sitetype = trackingEvent.sitetype;
				_econdaVideoPlayTarget.Target = ['SPV', 'Play Video', '1', 'a'];
				window.emosPropertiesEvent(_econdaVideoPlayTarget);
				AppLog.info('Econda Tracking target play video: ' , _econdaVideoPlayTarget);
			});
		} else {
			jQuery(document).find('.jsVideoPlay').val('false');
		}

		return trackingEvent;
	};

	// *************
	// productquickview
	// *************
	MMS.Econda.pageType.productquickview = function(pageContext) {
		var trackingEvent = MMS.Econda.pageType.productdetails(pageContext);
		return trackingEvent;
	};

	// *************
	// availability reminder
	// *************
	MMS.Econda.pageType.availabilityreminder = function(pageContext) {
		var tempContent = 'Availability-Reminder/';
		if (pageContext.availabilityreminder.state == 'start') {
			tempContent = tempContent + '01 Start';
		} else if (pageContext.availabilityreminder.state == 'success') {
			tempContent = tempContent + '02 Success';
			if (pageContext.availabilityreminder.subscription) {
				tempContent = tempContent + '/01 With Subscription';
			} else {
				tempContent = tempContent + '/02 Without Subscription';
			}
		} else if (pageContext.availabilityreminder.state == 'error') {
			tempContent = tempContent + '03 Error';
		}
		if (pageContext.availabilityreminder != undefined && pageContext.availabilityreminder.product != undefined) {
			var content = tempContent + '/' + pageContext.availabilityreminder.product.id;
		}
		return new MMS.Econda.TrackingEvent(pageContext, content);
	};

	// *************
	// retailstore
	// *************
	MMS.Econda.pageType.retailstoreinventorysearch = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Storeverfuegbarkeit/01 Search/' + pageContext.retailstore.product.id);
	};

	MMS.Econda.pageType.retailstoreinventoryresults = function(pageContext) {
		var trackingEvent = null;
		if (pageContext.retailstore.searchStatus == 'ok') {
			trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Storeverfuegbarkeit/02 Result/' + pageContext.retailstore.searchResultCount + ' Results');
			trackingEvent.storeSearch = [pageContext.retailstore.searchPhrase, pageContext.retailstore.searchResultCount];
		} else if (pageContext.retailstore.searchStatus == 'productnotfound') {
			trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Storeverfuegbarkeit/02 Result/0 Results');
		}
		else if (pageContext.retailstore.searchStatus == 'locationnotfound') {
			trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Storeverfuegbarkeit/02 Result/Location Not Found/' + pageContext.retailstore.searchPhrase);
		}
		return trackingEvent;
	};

	MMS.Econda.pageType.retailstoreinventorydetail = function(pageContext) {
		var store = pageContext.retailstore.store;
		return new MMS.Econda.TrackingEvent(pageContext, 'Storeverfuegbarkeit/03 Detail/' + store.id + ' ' + store.name + ' ' + store.city);
	};

	// ****************************************************
	// cart
	// ****************************************************
	MMS.Econda.pageType.cocart = function(pageContext) {
		var product = pageContext.product;

		var orderProcess = '1_CO_V2_Cart';
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Checkout_v2/' + orderProcess);
		trackingEvent.orderProcess = orderProcess;

		if(!empty(pageContext.productLineItem) && !empty(pageContext.productLineItemOld)) {
			var quantityDiff = pageContext.productLineItem.quantity - pageContext.productLineItemOld.quantity;
			if(quantityDiff == 0) {
				trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pageContext.productLineItemOld, trackingEvent, 'c_rmv', 'CartPage');
				trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pageContext.productLineItem, trackingEvent, 'c_add', 'CartPage');
			} else if(quantityDiff > 0) {
				pageContext.productLineItemOld.quantity = Math.abs(quantityDiff);
				trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pageContext.productLineItemOld, trackingEvent, 'c_add', 'CartPage');
			} else if(quantityDiff < 0) {
				pageContext.productLineItem.quantity = Math.abs(quantityDiff);
				trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pageContext.productLineItem, trackingEvent, 'c_rmv', 'CartPage');
			}
		}

		return trackingEvent;
	};

	MMS.Econda.pageType.cocartaddproduct = function(pageContext) {
		var product = pageContext.product;

		// set content
		var content = 'Add to Cart/';
		if (product.isProductSetProduct && product.isProductSet != undefined) {
			content += '/' + product.productSet.categoryPath + '/' + product.productSet.name + '-' + product.productSet.id + '/' + product.name + '_' + product.id;
		} else {
			content += product.categoryPath + '/' + product.name + '_' + product.id;
		}
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, content);
		trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pageContext.product, trackingEvent, 'c_add');

		return trackingEvent;
	};

	MMS.Econda.pageType.cocartaddmultipleproducts = function(pageContext) {
		var product = pageContext.product;

		var orderProcess = '1_CO_V2_Cart';
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Checkout_v2/' + orderProcess);

		// add ecEvent for each product
		var i = 0;
		jQuery.each(pageContext.products,function(key,product) {
			trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, product, trackingEvent, 'c_add');
			trackingEvent.ec_Event[i].var3 = 'CartTransfer';
			i+=1;
		});

		return trackingEvent;
	};

	MMS.Econda.pageType.cocartremoveproduct = function(pageContext) {
		var product = pageContext.product;

		var orderProcess = '1_CO_V2_Cart';
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Checkout_v2/' + orderProcess);
		trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pageContext.productLineItem, trackingEvent, 'c_rmv', 'CartPage');
		trackingEvent.orderProcess = orderProcess;

		// checkoutset
		if (pageContext.checkoutFlags != undefined && pageContext.checkoutFlags.expressInitialEnabled != undefined && pageContext.checkoutFlags.expressInitialEnabled == true) {
			trackingEvent.checkoutset = [['Express Checkout V2']];
		} else {
			trackingEvent.checkoutset = [['Normal Checkout V2']];
		}


		return trackingEvent;
	};

	// ****************************************************
	// checkout
	// ****************************************************
	MMS.Econda.pageType.cologin = function(pageContext) {
		var product = pageContext.product;

		var orderProcess = '2_CO_V2_Login';
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Checkout_v2/' + orderProcess);
		trackingEvent.orderProcess = orderProcess;

		return trackingEvent;
	};

	MMS.Econda.pageType.coshipping = function(pageContext) {
		var product = pageContext.product;

		var orderProcess = '3_CO_V2_Address';
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Checkout_v2/' + orderProcess);
		trackingEvent.orderProcess = orderProcess;

		trackingEvent = MMS.Econda.lib.setCheckoutset(pageContext, trackingEvent);

		if(pageContext.basket
				&& pageContext.basket.restoredProductLineItems
				&& pageContext.basket.restoredProductLineItems.length > 0) {
			var hastMergeRelevantItems = false;
			jQuery.each(pageContext.basket.restoredProductLineItems,function(key,pli) {
				if(pli.mergeRelevant == true && pli.addedToCart == false) {
					hastMergeRelevantItems = true;
				}
			});
			if(hastMergeRelevantItems == true) {
				MMS.Econda.lib.addAdditionTarget(['Restore Basket', 'Dialog show', '1', 'd']);
			}
		}

		// remove event for restored productlineitems
		if(!empty(pageContext.storedBasket)) {
			jQuery.each(pageContext.storedBasket.allProductLineItems,function(key,pli) {
				trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pli, trackingEvent, 'c_rmv','restoreCart');
			});
		}

		return trackingEvent;
	};

	MMS.Econda.pageType.cobilling = function(pageContext) {
		var product = pageContext.product;

		var orderProcess = '4_CO_V2_Billing';
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Checkout_v2/' + orderProcess);
		trackingEvent.orderProcess = orderProcess;

		trackingEvent = MMS.Econda.lib.setCheckoutset(pageContext, trackingEvent);

		return trackingEvent;
	};

	MMS.Econda.pageType.cosummary = function(pageContext) {
		var product = pageContext.product;

		var orderProcess = '5_CO_V2_Summary';
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Checkout_v2/' + orderProcess);
		trackingEvent.orderProcess = orderProcess;

		trackingEvent = MMS.Econda.lib.setCheckoutset(pageContext, trackingEvent);

		return trackingEvent;
	};

	MMS.Econda.pageType.coconfirmation = function(pageContext) {
		var product = pageContext.product;

		var orderProcess = '6_CO_V2_Confirmation';
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Checkout_v2/' + orderProcess);
		trackingEvent.orderProcess = orderProcess;

		// ec_Event
		jQuery.each(pageContext.order.allProductLineItems,function(key,pli) {
			trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pli, trackingEvent, 'buy');
		});

		// payment
		trackingEvent.payment = [];
		jQuery.each(pageContext.order.payments,function(key,value) {
			trackingEvent.payment.push(new Array(value.method,value.amount.eurValue,value.cardNumber));
		});

		// billing
		var billing = [];
		var billingAddress = pageContext.order.billingAddress;
		var shippingAddress = pageContext.order.shipments[0].shippingAddress;

		// [01] orderNo
		billing.push(pageContext.order.orderNo);

		// [02] customer id
		billing.push(pageContext.customer.customerNoHashed);

		var billingPostalString = '';
		if (billingAddress.postalCode != undefined && billingAddress.postalCode.length > 0){
			billingPostalString  = billingAddress.postalCode.substring(0, 1) + '/' + billingAddress.postalCode.substring(0, 2);
		}

		// [03] billing address
		var billingAddressString = billingAddress.country + '/' + billingPostalString + '/' + billingAddress.city + '/' + billingAddress.postalCode;
		billing.push(billingAddressString);

		// [04] order price
		var orderTrackingPrice;
		if (pageContext.order.orderType == 'GIFT_CARD') {
			orderTrackingPrice = '0.00';
		} else {
			orderTrackingPrice = pageContext.order.adjustedMerchandizeTotalNetPrice.eurValue;
		}
		billing.push(orderTrackingPrice);

		// [05] payment
		billing.push(pageContext.order.payments[0].name);

		// [06] shipping
		billing.push(pageContext.order.shipments[0].name);

		// [07] birthday
		billing.push(billingAddress.birthday);

		// [08] gender
		billing.push(pageContext.order.billingAddress.salutation=='m'?'Male':'Female');

		// [09] shipping address only if diff to shipping address
		if (pageContext.order.shipments[0].differentShippingAddress) {
			var shippingPostalString = '';
			if (shippingAddress.postalCode != undefined && shippingAddress.postalCode.length > 0){
				shippingPostalString  = shippingAddress.postalCode.substring(0, 1) + '/' + shippingAddress.postalCode.substring(0, 2);
			}

			var shippingAddressString = shippingAddress.country + '/' + shippingPostalString + '/' + shippingAddress.city + '/' + shippingAddress.postalCode;
			if (shippingAddress.type == 'DHL Packstation') {
				shippingAddressString += '/Packstation';
			} else if (shippingAddress.type == 'DHL Postfiliale') {
				shippingAddressString += '/Postfiliale';
			} else if (shippingAddress.type == 'Hermes Paketshop') {
				shippingAddressString += '/Paketshop';
			} else if (shippingAddress.type == 'Packstation') {
				shippingAddressString += '/Packstation';
			} else if (shippingAddress.type == 'Wunschfiliale') {
				shippingAddressString += '/Wunschfiliale';
			} else if (shippingAddress.type == 'MyPost24') {
				shippingAddressString += '/MyPost24';
			} else if (shippingAddress.type == 'PickPost') {
				shippingAddressString += '/PickPost';
			}
			billing.push(shippingAddressString);
		} else {
			billing.push('null');
		}

		// [10] customer type
		if (pageContext.customer.level == 'customer') {
			if (pageContext.order.trackingInformation != undefined && pageContext.order.trackingInformation.register == 'true') {
				billing.push('neu');
			} else {
				billing.push('registriert');
			}
		} else {
			billing.push('gast');
		}

		// [11] discounts
		billing.push(pageContext.order.discounts.eurValue);

		// [12] address type
		billing.push(shippingAddress.type);

		// [13] shipping costs
		billing.push(pageContext.order.adjustedShippingTotalNetPrice.eurValue);

		// [14] sum of net list prices
		var tmpSum	= 0;
		jQuery.each(pageContext.order.allProductLineItems,function(key,pli) {
			tmpSum += parseFloat(pli.netListPrice.eurValue) * pli.quantity;
		});
		billing.push(tmpSum.toFixed(2).toString());

		// add billing to tracking event
		trackingEvent.billing = billing;

		// billing ext
		if (pageContext.order.priceAdjustments != undefined && pageContext.order.priceAdjustments.length > 0 ) {
			var priceAdjustments = [];
			jQuery.each(pageContext.order.priceAdjustments,function(key,value) {
				var priceAdjustment = value;
				var promotionID = priceAdjustment.promotionID;
				var trackingEnabled = true;
				if (typeof pageContext.order.activePromotions != 'undefined') {
					var activePromotionData = pageContext.order.activePromotions[promotionID];
					if (typeof activePromotionData != 'undefined') {
						var trackingInformation = activePromotionData.trackingInformation;
						if (typeof trackingInformation != 'undefined' && trackingInformation != null) {
							var trackinEconda = trackingInformation.econda;
							if (typeof trackinEconda != 'undefined' && trackinEconda != null) {
								trackingEnabled = (trackinEconda.trackable == true);
							}
						}
					}
				}
				if (trackingEnabled) {
					priceAdjustments.push([promotionID, priceAdjustment.value.eurValue, priceAdjustment.couponID]);
				}
			});
			// add billingext to tracking event
			trackingEvent.billingext = priceAdjustments;
		}

		// cart merge tracking target on order submit
		var target = null;
		jQuery.each(pageContext.order.allProductLineItems,function(key,pli) {
			if(pli.trackingInformation != undefined && pli.trackingInformation.origin != undefined && pli.trackingInformation.origin == 'cartmerge') {
				MMS.Econda.lib.addAdditionTarget(['Cart Transfer', 'Items bought', '1', 'd']);
				return false;
			}
		});

		// giftpackaging tracking target on order submit
		jQuery.each(pageContext.order.allProductLineItems,function(key,pli) {
			if(pli.giftPackagingSelected) {
				MMS.Econda.lib.addAdditionTarget(['Gift Packaging', 'Products', '1', 'a']);
			}
		});

		return trackingEvent;
	};

	MMS.Econda.pageType.coregisterconfirmation = function(pageContext) {
		var product = pageContext.product;

		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Checkout_v2/7_CO_V2_SubsequentRegistration');

		if(pageContext.customer.registerMarker) {
			trackingEvent.register = [[pageContext.customer.hashedMail, 0]];
		} else {
			trackingEvent.register = [[pageContext.customer.hashedMail, 1]];
		}

		return trackingEvent;
	};

	// *************
	// giftcard
	// *************
	MMS.Econda.pageType.giftcard = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Catalog/Geschenkkarte');
	};
	MMS.Econda.pageType.giftcardamount = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Catalog/Geschenkkarte/' + parseInt(pageContext.product.price.eurValue));
	};
	MMS.Econda.pageType.giftcardtheme = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Catalog/Geschenkkarte/' + parseInt(pageContext.product.price.eurValue) + '/' + pageContext.product.colorCode);
	};
	MMS.Econda.pageType.giftcardgreeting = function(pageContext) {
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Catalog/Geschenkkarte/' + parseInt(pageContext.product.price.eurValue) + '/' + pageContext.product.colorCode);
		trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pageContext.product, trackingEvent, 'view');
		return trackingEvent;
	};
	MMS.Econda.pageType.giftcardaddtocart = function(pageContext) {
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Catalog/Geschenkkarte/' + parseInt(pageContext.product.price.eurValue) + '/' + pageContext.product.colorCode);
		trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pageContext.product, trackingEvent, 'c_add');
		return trackingEvent;
	};

	// *************
	// myaccount / Mein Konto
	// *************
	MMS.Econda.pageType.myaccountlogin = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto');
	};
	MMS.Econda.pageType.myaccounthome = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/Mein Konto');
	};
	MMS.Econda.pageType.myaccountprofile = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/Persönliche Daten');
	};
	MMS.Econda.pageType.myaccountpassword = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/Passwort ändern');
	};
	MMS.Econda.pageType.myaccountaddressbook = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/Lieferadressbuch');
	};
	MMS.Econda.pageType.myaccountpayment = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/Zahlungs- und Versandart');
	};
	MMS.Econda.pageType.myaccountnewsletter = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/Newsletter');
	};
	MMS.Econda.pageType.myaccountpoints = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/s.Oliver Points');
	};
	MMS.Econda.pageType.myaccountcard = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/s.Oliver Card');
	};
	MMS.Econda.pageType.myaccountwishlist = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/Merkzettel');
	};
	// *************
	// myaccount / onlinereturns
	// *************
	MMS.Econda.pageType.myaccountonlinereturnsstart = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/OnlineRetoure/Startseite');
	};
	MMS.Econda.pageType.myaccountonlinereturnshoworders = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/OnlineRetoure/Auswahl Bestellung');
	};
	MMS.Econda.pageType.myaccountonlinereturnsselectproducts = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/OnlineRetoure/Auswahl Produkte');
	};
	MMS.Econda.pageType.myaccountonlinereturnsreview = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/OnlineRetoure/Auftrag prüfen');
	};
	MMS.Econda.pageType.myaccountonlinereturnsconfirmation = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/OnlineRetoure/Retourendetails');
	};
	MMS.Econda.pageType.myaccountonlinereturnsoverview = function(pageContext) {
		return new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/OnlineRetoure/Retourenübersicht');
	};

	// *************
	// wishlist
	// *************
	MMS.Econda.pageType.myaccountwishlistadd = function(pageContext) {
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/Merkzettel');
		trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, pageContext.product, trackingEvent, 'wlist_add');

		// get viewtype var3
		var tmpHistory = PageContext.history;
		var historyPageType = '';
		// check page type from previous page
		for(var i = tmpHistory.length - 1; i >= 0; i--){
			if(tmpHistory[i].global.pageType == 'categoryshow') {
				historyPageType = 'OV';
				break;
			}
			if(tmpHistory[i].global.pageType == 'productdetails') {
				historyPageType = 'spvPage';
				break;
			}
		}
		trackingEvent.ec_Event[0].var3 = historyPageType;

		return trackingEvent;
	};

	MMS.Econda.pageType.myaccountwishlistremove = function(pageContext) {
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Mein Konto/Merkzettel');
		// add ecEvent for each product
		jQuery.each(pageContext.products,function(key,product) {
			trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, product, trackingEvent, 'wlist_rmv');
		});
		return trackingEvent;
	};

	MMS.Econda.pageType.myaccountwishlistcartadd = function(pageContext) {
		var orderProcess = '1_CO_V2_Cart';
		var trackingEvent = new MMS.Econda.TrackingEvent(pageContext, 'Checkout_v2/' + orderProcess);
		// add ecEvent for each product
		jQuery.each(pageContext.products,function(key,product) {
			trackingEvent = MMS.Econda.lib.createEcEvent(pageContext, product, trackingEvent, 'c_add');
		});
		return trackingEvent;
	};

	MMS.Econda.TrackingEvent = function(pageContext, content) {
		this.content = MMS.LocalConstants.get('global.brand') + '/' + content;
		this.pageId	= this.content;
		this.siteid = MMS.LocalConstants.get('econda.siteId');
		this.langid = MMS.LocalConstants.get('global.language');
		this.sitetype = MMS.Econda.lib.getSiteType();
		this.release = [[PageContext.get('global.systemcodeversion')]];
		this.addinfo = MMS.Econda.lib.setNavTrackingData(pageContext);
	}

	MMS.Econda.trackOnView = function(pageContext) {
		var logPrefix = 'Econda Tracking V2:';

		// disable legacy tracking
		if(!empty(pageContext.noTrack) && pageContext.noTrack == true) {
			AppLog.info(logPrefix,'disable legacy tracking:', pageContext.global.pageType);
			return;
		}

		function _callEconda() {
			// set econda customer no
			// important todo before load emos script!!!
			window.emos_dwkdnr = MMS.LocalConstants.get('econda.id');

			// load script and call tracking function
			if (MMS.Econda.disableTracking == false) {
				var loaded = MMS.DependencyLoader.loadByURL(MMS.LocalConstants.get('econda.scriptURL'), null, true);
				loaded.then(_onLoadSuccess);
			}

			// additional dummy tracking needed by test automation
			if (MMS.LocalConstants.get('global.instanceType') != 'prd') {
				var econdaJSON = JSON.stringify(MMS.Econda.trackingEvent);
				var dummyURL = MMS.LocalConstants.get('global.staticImageURL').replace('images','js') + 'trackingblank.js';
				dummyURL += '?econda=' +  encodeURIComponent(econdaJSON);
				MMS.DependencyLoader.loadByURL(dummyURL, null, true);
			}
		};

		function _onLoadSuccess() {

			window.emosPropertiesEvent(MMS.Econda.trackingEvent);

			// save econda object to pagecontext for future use e.g. click tracking
			pageContext.custom.econda = {};
			pageContext.custom.econda.lastEventObject = MMS.Econda.trackingEvent;

			// send event
			if(!MMS.Econda.loadedEventTriggered) {
				MMS.Econda.loadedEventTriggered = true;
				jQuery(document).trigger('econdaLoaded');
				MMS.EventMgr.trigger(_document, 'mms:econda:loaded');
			}

			// send additional targets
			if (MMS.Econda.additionalTargets != undefined && MMS.Econda.additionalTargets != null) {
				jQuery.each(MMS.Econda.additionalTargets,function(key,value) {
					var _econdaAdditionalTarget = new Object();
					_econdaAdditionalTarget.siteid = MMS.Econda.trackingEvent.siteid;
					_econdaAdditionalTarget.sitetype = MMS.Econda.trackingEvent.sitetype;
					_econdaAdditionalTarget.Target = value;
					window.emosPropertiesEvent(_econdaAdditionalTarget);

					// additional dummy tracking needed by test automation
					if (MMS.LocalConstants.get('global.instanceType') != 'prd') {
						var econdaJSON = JSON.stringify(_econdaAdditionalTarget);
						var dummyURL = MMS.LocalConstants.get('global.staticImageURL').replace('images','js') + 'trackingblank.js';
						dummyURL += '?econda=' +  encodeURIComponent(econdaJSON);
						MMS.DependencyLoader.loadByURL(dummyURL, null, true);
					}
				});
				MMS.Econda.additionalTargets = [];
			}
		}

		// call dynamic tracking function by pagetype
		var func = MMS.Econda.pageType[pageContext.global.pageType];
		if(jQuery.isFunction(func)){
			MMS.Econda.trackingEvent = func(pageContext);
		} else {
			AppLog.info(logPrefix + ' no tracking function defined for pagetype ', pageContext.global.pageType);
			return;
		}

		// if do not track return
		if(MMS.Econda.doNotTrack) {
			MMS.Econda.doNotTrack = false;
			return;
		}

		// set global customer data
		MMS.Econda.lib.setGlobalCustomerData(pageContext);

		// callEconda
		_callEconda();
	};

	jQuery(document).bind('track:onview', function(event) {
		MMS.Econda.trackOnView(event.eventData);
	});

})(jQuery, window, document);

// workaround giftcard add to cart tracking without confirmation layer/page
jQuery(document).bind("page:ready", function(event) {
	// Giftcard AjaxForms Submit Add Event Trigger
	if (typeof(AjaxFormsConstants) != 'undefined') {
		jQuery(document).bind(AjaxFormsConstants.onAjaxStart, function(event) {
			var context = PageContext.currentDataModel;
			var globalAvailablePages  = PageContext.get('global.availablePages');
			if (context.global.pageType == globalAvailablePages.giftcardgreeting && jQuery(event.eventData.form.context).hasClass('jsNoTracking') == false) {
				context.global.pageType = globalAvailablePages.giftcardaddtocart;
				jQuery(document).trigger({
					type: "track:onview",
					eventData : context
				});
			}
		});
	}
});

	/* ]]> */
// -->


//<!--
/* <![CDATA[ */
var econdaProductTracking = {
		pageContext : null,
		econdaID : null,
		init : function() {
			jQuery(document).on( "mouseenter", ".jsRecoContainer .jsRecommendedProduct a:not(.jsQuickViewLink)", function() {
				// add econda data on href in the recommendations
				econdaProductTracking.trackingProductRecommendation(this);
			});
			jQuery(document).on( "click", ".jsRecoContainer .jsRecommendedProduct a.jsQuickViewLink", function() {
				// click on recommendation and open in quickview
				econdaProductTracking.trackingProductRecommendationQuickview(this);
			});
			jQuery(document).on( "mouseenter", ".jsRecoContainer .jsSeriesProduct", function() {
				// add econda data on href in the recommendations
				econdaProductTracking.trackingSeriesRecommendation(this);
			});
			jQuery(document).bind("page:onpagecontextupdate", function(event) {
				pageContext = PageContext.getFirst();
				econdaID = PageContext.get('global.constants.econda.ID');
			});
		},
		trackingProductRecommendationQuickview : function (productRecoLink) {
			if (
				PageContext.get('global.availablePages.cartshow') == pageContext.global.pageType ||
				PageContext.get('global.availablePages.cocart') == pageContext.global.pageType ||
				PageContext.get('global.availablePages.productdetails') == pageContext.global.pageType
			) {
				var econdaTrackingData = new Array();
				econdaTrackingData = econdaProductTracking.getEcondaTrackingData(productRecoLink);
				window.emcs0 = econdaTrackingData['emcs0'];
				window.emcs1 = econdaTrackingData['emcs1'];
				window.emcs2 = econdaTrackingData['emcs2'];
				window.emcs3 = econdaTrackingData['emcs3'];
				window.emosPropertiesEvent("quickviewRecommendations");

				AppLog.info("Econda Tracking: (quickviewRecommendations)",econdaTrackingData);
				window.emcs0 = window.emcs1 = window.emcs2 = window.emcs3 = undefined;
			}
		},

		trackingProductRecommendation : function (productRecoLink) {
			productRecoLink = jQuery(productRecoLink);
			var linkURL = productRecoLink.attr('href') || '';

			if (productRecoLink.data('emcs-tracking') != true
				&& linkURL.slice(-1) != '#')
			{
				// attach the parameters to the linkURL
				econdaTrackingData = econdaProductTracking.getEcondaTrackingData(productRecoLink.get(0));

				linkURL += linkURL.indexOf("?")==-1?"?":"&";
				linkURL += "emcs0=" + econdaTrackingData['emcs0'] + "&";
				linkURL += "emcs1=" + econdaTrackingData['emcs1'] + "&";
				linkURL += "emcs2=" + econdaTrackingData['emcs2'] + "&";
				linkURL += "emcs3=" + econdaTrackingData['emcs3'];

				productRecoLink.attr('href', linkURL);
				productRecoLink.data('emcs-tracking',true);
			}
		},

		trackingSeriesRecommendation : function (productRecoLink) {
			productRecoLink = jQuery(productRecoLink);
			var linkURL = productRecoLink.attr('href') || '';

			if (linkURL != "") {
				if (productRecoLink.data('emcs-tracking') != true
					&& linkURL.slice(-1) != '#')
				{
					// attach the parameters to the linkURL
					econdaTrackingData = econdaProductTracking.getEcondaTrackingData(productRecoLink.get(0));

					linkURL += linkURL.indexOf("?")==-1?"?":"&";
					linkURL += "emcs0=" + econdaTrackingData['emcs0'] + "&";
					linkURL += "emcs1=" + econdaTrackingData['emcs1'] + "&";
					linkURL += "emcs2=" + econdaTrackingData['emcs2'] + "&";
					linkURL += "emcs3=" + econdaTrackingData['emcs3'];

					productRecoLink.attr('href', linkURL);
					productRecoLink.data('emcs-tracking',true);
				}
			} else {
				var slotID = jQuery(productRecoLink).parent().closest('.jsRecoContainer').attr('data-slotid');
				var size = productRecoLink.data('sizeid');
				var recoEngine = productRecoLink.data('recoengine');

				var masterIDTarget = jQuery(productRecoLink).parent().closest('.jsProductVariations').data('master');

				var productRecoElement = jQuery(productRecoLink).parent().closest('.jsRecoTracking');
				var recommendedProductRank = productRecoElement.data("recommendation-count");
				var quickviewURL = productRecoElement.data('quickviewurl');
				var masterID = PageContext.currentDataModel.product.masterId;


				var trackingParams = "&";
				trackingParams += "emcs0=" + "eng:" + recoEngine + "&";
				trackingParams += "emcs1=" + slotID + "_" + recommendedProductRank + "&";
				trackingParams += "emcs2=" + masterID + "&";
				trackingParams += "emcs3=" + masterIDTarget;
				productRecoElement.data('quickviewurl',quickviewURL + trackingParams);
			}
		},

		getEcondaTrackingData : function (productRecoLink) {

			var econdaTrackingData = new Array();
			econdaTrackingData['emcs0'] = null;
			econdaTrackingData['emcs1'] = null;
			econdaTrackingData['emcs2'] = null;
			econdaTrackingData['emcs3'] = null;

			var recommendationLinkUrl = productRecoLink.href;
			var recommendationEngine = jQuery(productRecoLink).attr('data-recoengine');
			var getParameters_emcs = new Array();

			// Define Position in slot
			if (productRecoLink.getAttribute("data-recommendation-count") != null && productRecoLink.getAttribute("data-recommendation-count") > 0) {
				// test for the new Recommendation Konfiguration
				var recommendedProducts = jQuery(productRecoLink).parent().parent().children(".jsRecommendedProduct");
				var recommendedProductRank = productRecoLink.getAttribute("data-recommendation-count");
			}
			else if (jQuery(productRecoLink).parent().parent().parent().children(".products").length > 0)
			{
				// test for the old Recommendation Konfiguration
				var recommendedProducts = jQuery(productRecoLink).parent().parent().children(".jsRecommendedProduct");
				var recommendedProductRank = recommendedProducts.index(jQuery(productRecoLink).parent()) + 1;
			}
			else
			{
				// test for the old Recommendation Konfiguration
				var recommendedProducts = jQuery(productRecoLink).parent().parent().parent().children(".jsRecommendedProduct");
				var recommendedProductRank = recommendedProducts.index(jQuery(productRecoLink).parent().parent()) + 1;
			}

			// collect informations about the recommendation engine
			switch(recommendationEngine) {
				case "econda":
						var econdareco_widgetID = productRecoLink.getAttribute('econda-widgetid');
						econdaTrackingData['emcs0'] = "eng:" + recommendationEngine + "~widgetID:" + econdareco_widgetID;
						break;
				case "sortingrule":
						var sortingrule_name = productRecoLink.getAttribute('data-sortingrule');
						econdaTrackingData['emcs0'] = "eng:sort~rule:" + sortingrule_name;
						break;
				case "dwrecommendation":
						econdaTrackingData['emcs0'] = "eng:dw";
						break;
				case "fixedproducts":
						econdaTrackingData['emcs0'] = "eng:" + recommendationEngine;
						break;
				default:
						econdaTrackingData['emcs0'] = "eng:" + recommendationEngine;
						break;
			}

			// collect slot id
			var slot_id = jQuery(productRecoLink).parent().closest('.jsRecoContainer').attr('data-slotid');
			if (slot_id != 'undefined') {
				econdaTrackingData['emcs1'] = slot_id + "_" + recommendedProductRank;
			}

			// collect basic product
			econdaTrackingData['emcs2'] = empty(jQuery(productRecoLink).attr('data-scopeproduct'))?"":jQuery(productRecoLink).attr('data-scopeproduct');

			// collect recommendation product
			econdaTrackingData['emcs3'] = empty(jQuery(productRecoLink).attr('data-recoproduct'))?"":jQuery(productRecoLink).attr('data-recoproduct');
			return econdaTrackingData;
		},

	};

	econdaProductTracking.init();

/* ]]> */
// -->


//<!--
/* <![CDATA[ */

/*
 * ID:TRACKING_ECONDA_CLICKTRACK
 */

	jQuery(document).bind("page:clicktrack", function(event) {
		if (PageContext.getFirst().custom.econda == undefined) {
			PageContext.getFirst().custom.econda = {};
		}
		// sitetype
		if (PageContext.get('global.constants.brand.name') == 'soliver') {
			PageContext.getFirst().custom.econda.sitetype = [[SOLI.getCurrentBreakpoint()]];
		}
	});

/* ]]> */
// -->



//<!--
/* <![CDATA[ */

/*
 * ID:TRACKING_ECONDA_CLICKTRACK_CORE
 */

	jQuery(document).bind("page:clicktrack", function(event) {

		var _navtracking = event.eventData.navtracking ? event.eventData.navtracking : null;

		if(_navtracking != null) {
			// write new cookie
			var trackingNav = {};
			trackingNav.pagetypePrevious = PageContext.getFirst().global.pageType;
			trackingNav.navigationElement = _navtracking;
			CookieUtils.createCookie("trackNav", trackingNav);
		}

	});

	jQuery(document).bind("page:clicktrack", function(event) {


		try {
			var _econda = event.eventData.econda ? event.eventData.econda : {};
			var _emospro = {};

			// ===============================================
			// this is the Site-ID. Change it for other sites
			// -----------------------------------------------

			_emospro.siteid = PageContext.get("global.constants.site.id");

			// set current content and pageId properties
			_emospro.content = PageContext.get("custom.econda.lastEventObject.content");
			_emospro.pageId = _emospro.content;

			//================================================

			extractRef(_econda,_emospro, event);
			extractTargetClick(_econda, _emospro);
			extractMarkerClick(_econda, _emospro);
			extractMagalogClick(_econda, _emospro, event);

			// sitetype
			_emospro.sitetype = PageContext.get("custom.econda.sitetype");

			if(PageContext.getFirst().global.instanceType != "prd") {
				// just do logging for non-production systems
				AppLog.info("Econda emospro Clicktrack-Object: ", _emospro);
				var econdaClickTrackJSON = JSON.stringify(_emospro);
				var dummyURL = PageContext.getFirst().global.staticImageURL.replace('images','js') + 'trackingblank.js';
				dummyURL += "?econdaclicktrack=" +  encodeURIComponent(econdaClickTrackJSON);
				CoreUtils.loadExternalScript(dummyURL, function(){return true;}, function(){return true;}, false);
				}
			window.emosPropertiesEvent(_emospro);

		}
		catch(e) {
			AppLog.info("page:clicktrack error", e);
		}

		// ==================================================
		// helper functions for checking clicktracking scope
		// --------------------------------------------------

		function extractRef(_econda,_emospro, event) {
			var refs = {
				"spv_breadcrumb" : {
					"target":{"group":"SPV","name":"Breadcrumb","value":"1","calc":"a"}
				},
				"spv_thumbnail" : {
					"target":{"group":"SPV","name":"Thumbnail","value":"1","calc":"a"}
				},
				"spv_backlink": {
					"target":{"group":"SPV","name":"Backlink","value":"1","calc":"a"}
				},
				"spv_fittingguide_open": {
					"target":{"group":"SPV","name":"Fitguide Opened: Table","value":"1","calc":"a"}
				},
				"spv_fittingguide_truefit_open": {
					"target":{"group":"SPV","name":"Fitguide Opened: True Fit","value":"1","calc":"a"}
				},
				"spv_fittingguide_truefit_completed": {
					"target":{"group":"SPV","name":"Fitguide Completed: True Fit","value":"1","calc":"a"}
				},
				"spv_fittingguide_truefit_more": {
					"target":{"group":"SPV","name":"Fitguide Info: True Fit","value":"1","calc":"a"}
				},
				"spv_fittingguide_fit_analytics_open": {
					"target":{"group":"SPV","name":"Fitguide Opened: Fit Analytics","value":"1","calc":"a"}
				},
				"spv_fittingguide_fit_analytics_completed": {
					"target":{"group":"SPV","name":"Fitguide Completed: Fit Analytics","value":"1","calc":"a"}
				},
				"spv_fittingguide_fit_analytics_more": {
					"target":{"group":"SPV","name":"Fitguide Info: Fit Analytics","value":"1","calc":"a"}
				},
				"spv_productinfo": {
					"target":{"group":"SPV","name":"Produktinformationen","value":"1","calc":"a"}
				},
				"spv_shippinginfo": {
					"target":{"group":"SPV","name":"Versandkosten","value":"1","calc":"a"}
				},
				"spv_careadvice": {
					"target":{"group":"SPV","name":"Material Pflegehinweise","value":"1","calc":"a"}
				},
				"spv_braguide": {
					"target":{"group":"SPV","name":"BH-Guide","value":"1","calc":"a"}
				},
				"spv_wishlist": {
					"target":{"group":"SPV","name":"Add2Wishlist","value":"1","calc":"a"}
				},
				"spv_seriesproducts": {
					"target":{"group":"SPV","name":"Artikel Serie","value":"1","calc":"a"}
				},
				"spv_retailstoreinventory": {
					"target":{"group":"SPV","name":"Storeverfügbarkeit","value":"1","calc":"a"}
				},
				"spv_fullscreen": {
					"target":{"group":"SPV","name":"Fullscreen","value":"1","calc":"a"}
				},
				"spv_image_prev": {
					"target":{"group":"SPV","name":"Image_Nav_Left","value":"1","calc":"a"}
				},
				"spv_image_next": {
					"target":{"group":"SPV","name":"Image_Nav_Right","value":"1","calc":"a"}
				},
				"spv_facebook": {
					"target":{"group":"SPV","name":"Facebook","value":"1","calc":"a"}
				},
				"spv_ichat": {
					"target":{"group":"SPV","name":"Onlineberatung","value":"1","calc":"a"}
				},
				"spv_pinterest": {
					"target":{"group":"SPV","name":"Pinterest","value":"1","calc":"a"}
				},
				"cat_grid3": {
					"target":{"group":"OV Setting","name":"Grid: 3 Produkte","value":"1","calc":"a"}
				},
				"cat_grid4": {
					"target":{"group":"OV Setting","name":"Grid: 4 Produkte","value":"1","calc":"a"}
				},
				"cat_view_model": {
					"target":{"group":"OV Setting","name":"View: Model","value":"1","calc":"a"}
				},
				"cat_view_product": {
					"target":{"group":"OV Setting","name":"View: Product","value":"1","calc":"a"}
				},
				"cat_categoryslot": {
					"target":{"group":"Search","name":"Category Slot","value":"1","calc":"a"}
				},
				"cart_product_not_available": {
					"target":{"group":"Cart","name":"Out of stock","value":"1","calc":"s"}
				},
				"cart_wishlist": {
					"target":{"group":"Cart","name":"Wishlist-Include","value":"1","calc":"a"}
				},
				"login" : {"group":"","name":"","value":"1","calc":"a"},
				"loginmodal_login" : {
					"group":"Relogin Modal/Login","name":"","value":"1","calc":"a"
				},
				"loginmodal_forgotpw" : {
					"group":"Relogin Modal/Forget Passwort","name":"","value":"1","calc":"a"
				},
				"suggest_display": {
					"target":{"group":"Onsite Search","name":"Display Suggestions","value":"1","calc":"a"}
				},
				"suggest_product": {
					"target":{"group":"Onsite Search","name":"Open " + _econda.type,"value":"1","calc":"a"}
				},
				"product_tile_swatch": {
					"target":{"group":"OV Produktkarte","name":"KlickFarbSwatch","value":"1","calc":"a"}
				},
				"ov_wishlist": {
					"target":{"group":"OV Produktkarte","name":"Add2Wishlist","value":"1","calc":"a"}
				},
			};
			if(typeof(_econda.ref) != 'undefined' && _econda.ref != null) {
				var ref = _econda.ref
				if (typeof(refs[ref].target) != 'undefined' && ( typeof(refs[ref].target.group) == 'undefined' || refs[ref].target.group == "" )) {
					var viewType = getViewType(PageContext.currentDataModel);
					refs[ref].target.group = viewType;
				}
				if (refs[ref] != 'undefined') {
					extractTargetClick(refs[ref], _emospro);
					extractMarkerClick(refs[ref], _emospro);
					extractLoginClick(refs[ref], _emospro, ref, event);
				}
			}
		}

		function getViewType(context) {
			var viewType = "";
			var isProductSet = context.product.isProductSet;
			var isProductSetProduct = context.product.isProductSetProduct;

			if(context.global.pageType == "productquickview") {
				if (isProductSet || isProductSetProduct) {
					viewType = "stlQV";
				} else {
					viewType = "spvQV";
				}
			} else {
				if (isProductSet || isProductSetProduct) {
					viewType = "stlPage";
				} else {
					viewType = "spvPage";
				}
			}
			return viewType;
		};

		function extractTargetClick(_econda, _emospro) {
			// check if we have a target tracking
			if(typeof(_econda.target) != 'undefined' && _econda.target != null) {
				var tmpTarget = _emospro.Target;

				if( typeof(tmpTarget) == 'undefined' || tmpTarget == null || tmpTarget.length == 0 ||
					typeof(tmpTarget[0]) == 'undefined' || tmpTarget[0] == null || tmpTarget[0].length != 4) {
					tmpTarget = [['', '', '', '']];
				}
				if(_econda.target.group != null) {
					tmpTarget[0][0] = _econda.target.group;
				}
				if(_econda.target.name != null) {
					tmpTarget[0][1] = _econda.target.name;
				}
				if(_econda.target.value != null) {
					tmpTarget[0][2] = _econda.target.value;
				}
				if(_econda.target.calc != null) {
					tmpTarget[0][3] = _econda.target.calc;
				}
				_emospro.Target = tmpTarget;
				_emospro.rqtype = 'hiddenpi';
			}
		}

		function extractMarkerClick(_econda, _emospro) {
			// check for marker
			if(typeof(_econda.marker) != 'undefined' && _econda.marker != null) {
				_emospro.marker = _econda.marker;
				_emospro.rqtype = 'hiddenpi';
			}
		}

		function extractMagalogClick(_econda, _emospro, event) {
			// check for magalog click
			if(typeof(_econda.magalog) != 'undefined' && _econda.magalog != null) {
				var pid = jQuery(event.target).attr('href').split("'")[1];
				var prefix = _econda.magalog.markerprefix;
				var page = _econda.magalog.page;

				_emospro.marker = prefix + "/Seite_" + page + "/" + pid;
			}
		}

		function extractLoginClick(_econda, _emospro, ref, event) {
			if (ref == 'login') {
				if (PageContext.currentDataModel.custom != 'undefined') {
					var pageContextCustom = PageContext.currentDataModel.custom;
					if (PageContext.currentDataModel.global.pageType == PageContext.getFirst().global.availablePages.cologin) {
						var emailCardNoField = jQuery(event.target).closest('form').find('.jsEmailCardNo');
						if (emailCardNoField.val() != "" && emailCardNoField.val().indexOf("@") == -1) {
							_econda.group = "Login (Checkout)";
							_econda.name = "s.Oliver Card";
						} else {
							_econda.group = "Login (Checkout)";
							_econda.name =	"Email";
						}
						extractTargetClick( {"target": _econda}, _emospro);
					} else {
						var emailCardNoField = jQuery(event.target).closest('form').find('.jsEmailCardNo');
						if (emailCardNoField.val() != "" && emailCardNoField.val().indexOf("@") == -1) {
							_econda.group = "Login (My Account)";
							_econda.name = "s.Oliver Card";
						} else {
							_econda.group = "Login (My Account)";
							_econda.name = "Email";
						}
						extractTargetClick( {"target": _econda}, _emospro);
					}
				}
			} else if (ref == 'loginmodal_login' || ref == 'loginmodal_forgotpw') {
				var emailCardNoField = jQuery(event.target).closest('form').find('.jsEmailCardNo');
				if (emailCardNoField.val() != "" && emailCardNoField.val().indexOf("@") == -1) {
					_econda.name = "s.Oliver Card";
				} else {
					_econda.name = "Email";
				}
				extractTargetClick( {"target": _econda}, _emospro);
			}
		}
	});
/* ]]> */
// -->


//<!--
/* <![CDATA[ */
(function($) {

	$(document).one('econdaLoaded', function() {
		try {
			var globalBrand = PageContext.get('global.constants.brand');
			if(globalBrand.id != "so"){
				return;
			}

			var CustomerGroups = PageContext.get("customergroups");
			if(CustomerGroups == null) {
				return;
			}

			$.each(CustomerGroups,function(key,group) {

				if(		group.trackingInformation != undefined
					&&	group.trackingInformation.econda != undefined
					&&	(group.trackingInformation.econda.markertracking === true || group.trackingInformation.econda.markertracking === "true")){

					var emospro = {
						siteid:  PageContext.get("global.constants.site.id"),				// site ID
						content: PageContext.get("custom.econda.lastEventObject.content"),	// page name
						marker:  'CustomerGroup/' + group.id								// group ID
					};
					window.emosPropertiesEvent(emospro);									// send request
				}
			});
		}
		catch(e) {
			AppLog.info("page:econda_customergroups error", e);
		}
	});

})(jQuery);

/* ]]> */
// -->


//<!--
/* <![CDATA[ */

(function($, _window, _document){
	var processedElements = [];
	var page = null;

	MMS.Econda.OVCampaign = {

		VISIBLE_SCOLLING_OFFSET_PERCENT: 50,
		SCROLLING_OFFSET: 550,
		OV_GRID_ITEM: '.js-ovgrid-item',
		OV_LISTVIEW_TILE: '.js-ovlistview-tile',

		init: function() {

			// calculate scrolling offset
			var tmpGridItem = $(document).find(MMS.Econda.OVCampaign.OV_GRID_ITEM)[0];
			if(tmpGridItem != undefined) {
				MMS.Econda.OVCampaign.SCROLLING_OFFSET = $(tmpGridItem).height();
			}
			MMS.Econda.OVCampaign.SCROLLING_OFFSET = MMS.Econda.OVCampaign.SCROLLING_OFFSET * MMS.Econda.OVCampaign.VISIBLE_SCOLLING_OFFSET_PERCENT / 100;

			MMS.Econda.OVCampaign.initIndex();
			MMS.Econda.OVCampaign.initSelectedPage();
			MMS.Econda.OVCampaign.trackVisibleElements();
			MMS.Econda.OVCampaign.installListeners();

			$(document).off('mmstrackinginput').on('ovmodelloadsuccess.mmstrackinginput', function(event){
				processedElements = [];
			});

			$(document).off('mmstrackinginput').on('ovmodelloadsuccess.mmstrackinginput ovlazyloadchunkdone.mmstrackinginput', function(event){
				MMS.Econda.OVCampaign.initIndex();
				MMS.Econda.OVCampaign.initSelectedPage();
				MMS.Econda.OVCampaign.trackVisibleElements();
			});
		},

		getTrackingID: function(index, productID) {
			return 'OV/Product Impressions/' + PageContext.get('category.path') + '/' + page + '/' + index + '/' + productID;
		},

		initSelectedPage: function() {
			var selectedPageingItem = $('.js-ovlistview-pagingbar').find('.selected');
			page = $('.js-ovlistview-pagingbar .pagination__item').index( selectedPageingItem );
			if(page == -1) {
				page = 1;
			} else {
				page++;
			}
		},

		trackClick: function(event) {
			var element = $(event.target).closest(MMS.Econda.OVCampaign.OV_LISTVIEW_TILE);
			var index = $(event.target).closest(MMS.Econda.OVCampaign.OV_GRID_ITEM).attr('data-index');
			var productID = element.data('master') + '.' + element.data('color');
			var trackingID = MMS.Econda.OVCampaign.getTrackingID(index, productID);

			var emosproObject = {
					rqtype: 'hiddenpi',
					siteid: PageContext.get('global.constants.site.id')
				};
			emosproObject['icampc'] = [trackingID];

			window.emosPropertiesEvent(emosproObject);
		},

		trackColorChangeClick: function(event) {
			MMS.Econda.OVCampaign.initIndex();
			var element = $(event.target).closest(MMS.Econda.OVCampaign.OV_LISTVIEW_TILE);
			var index = $(event.target).closest(MMS.Econda.OVCampaign.OV_GRID_ITEM).attr('data-index');
			var productID = element.data('master') + '.' + element.data('color');

			if ( processedElements.indexOf(productID) != -1 ) {
				return true;
			}

			var trackingID = MMS.Econda.OVCampaign.getTrackingID(index, productID);

			var emosproObject = {
					rqtype: 'hiddenpi',
					siteid: PageContext.get('global.constants.site.id')
				};
			emosproObject['icampv'] = [trackingID];

			processedElements.push(productID);

			window.emosPropertiesEvent(emosproObject);
		},

		trackVisibleElements: function() {
			var elementsToTrack = $(document).find(MMS.Econda.OVCampaign.OV_GRID_ITEM);
			var documentScrollTop = $(document).scrollTop();
			var windowHeight = $(window).height();

			var emosproObject = {
					rqtype: 'hiddenpi',
					siteid: PageContext.get('global.constants.site.id')
				};
			emosproObject['icampv'] = [];

			var i = 1;
			elementsToTrack.each(function() {
				var element = $(this);
				var index = element.attr('data-index');
				var elementTile = element.find(MMS.Econda.OVCampaign.OV_LISTVIEW_TILE);
				var productID = elementTile.data('master') + '.' + elementTile.data('color');
				if(elementTile.length == 0) {
					return true;
				}
				if ( processedElements.indexOf(productID) != -1 ) {
					return true;
				}
				if (elementTile.attr('data-mms-tracking-processed') == undefined &&
					elementTile.offset().top + MMS.Econda.OVCampaign.SCROLLING_OFFSET < documentScrollTop + windowHeight &&
					elementTile.offset().top + element.height() - MMS.Econda.OVCampaign.SCROLLING_OFFSET > documentScrollTop) {
					var trackingID = MMS.Econda.OVCampaign.getTrackingID(index, productID);
					emosproObject['icampv'].push(trackingID);

					processedElements.push(productID);
					elementTile.attr('data-mms-tracking-processed','');
				}
			});

			if(emosproObject['icampv'].length > 0) {
				window.emosPropertiesEvent(emosproObject);
			}

		},

		initIndex: function() {
			var elementsToTrack = $(document).find(MMS.Econda.OVCampaign.OV_GRID_ITEM);
			var i = 1;
			elementsToTrack.each(function() {
				var element = $(this);
				element.attr('data-index', i);
				i++;
			});
		},

		installListeners: function() {
			$(document)
				.off('.mmstrackinginput')
				.on('scroll.mmstrackinginput', MMS.Econda.OVCampaign.trackVisibleElements)
				.on('ovlistviewcolorchanged.ovcontroller', function(event) {
					MMS.Econda.OVCampaign.trackColorChangeClick(event);
				})
				.on('click.mmstrackinginput', '.js-ovlistview-productdetaillink', function(event) {
					// no click event tracking for wishlist
					if(event.target.closest('div') != null && event.target.closest('div').classList.contains('jsPLProductSlider')) {
						return;
					}
					// no click event tracking for image slider
					if(event.target.closest('button') != null && event.target.closest('button').classList.contains('jsAddToWishlist')) {
						return;
					}
					MMS.Econda.OVCampaign.trackClick(event);
				});
		}
	};

	jQuery(document).bind('track:onview', function(event) {
		// ov campaign tracking only for category wo_ko_blusen
		if (PageContext.getFirst().global.pageType == PageContext.getFirst().global.availablePages.categoryshow && PageContext.get('category.path').indexOf('Damen/Bekleidung/Blusen') != -1) {
			$(document).off('mmstrackinginput').on('econdaLoaded.mmstrackinginput', MMS.Econda.OVCampaign.init);
		}
	});

})(jQuery, window, document);

	/* ]]> */
// -->


//<!--
/* <![CDATA[ */
	jQuery(document).bind("track:onview", function(event) {
		
		var _exactag = {};
		_exactag.campaign = "45fedd156f8f23508d61477178ed99e3";
		_exactag.url = window.location.host;

		var context = event.eventData;

		// disable legacy tracking
		if(!empty(context.noTrack) && context.noTrack == true) {
			AppLog.info('Exactag Tracking V2: disable legacy tracking:', context.global.pageType);
			return;
		}

		// do not track if global.pageType is empty
		if(empty(context.global.pageType)) {
			AppLog.info('Exactag Tracking V2: do not track in case of empty pageType');
			return;
		}


		// set external referrer
		var _externalReferrer = null;
		try {
			var _externalReferrer = JSON.parse(window.sessionStorage.getItem('externalReferrer'));
			if(_externalReferrer) {
				if(_externalReferrer.isSent == true && (empty(_externalReferrer.referrer) || empty(_externalReferrer.location))) {
					_externalReferrer.referrer = document.referrer;
					_externalReferrer.location = window.location.href;
				}
			} else {
				_externalReferrer = {};
				_externalReferrer.isSent = false;
				_externalReferrer.referrer = document.referrer;
				_externalReferrer.location = window.location.href;
			}

			window.sessionStorage.setItem('externalReferrer', JSON.stringify(_externalReferrer));
		} catch(e){}

		var enableLog = true;

		var globalAvailablePages  = PageContext.get('global.availablePages');
		var globalConstantsSite = PageContext.get('global.constants.site');

		var tools = {
			wrap: function(param) {
				var value;
				if (jQuery.isArray(param)) {
					value = param.join(',');
				} else {
					value = param;
				}
				if (!value) return '';
				return value;
			},
			getProperty: function(property, item) {
				if (property.indexOf('.') == -1){
					return item[property];
				}
				var propertyPath = property.split('.');
				item = item[propertyPath.shift()];
				return tools.getProperty(propertyPath.join('.'), item);
			},
			getAttributeList: function (list, property){
				return tools.wrap(jQuery.map(list,jQuery.proxy(tools.getProperty,null,property)));
			}
		};

		var doExacTagTracking = function _doExacTagTracking() {
			switch (context.global.pageType) {

			// *************
			// home
			// *************
			case globalAvailablePages.home:
				_exactag.sitegroup = 'Homepage';
				break;

			// *************
			// search
			// *************
			case globalAvailablePages.productsearch:
				_exactag.sitegroup = 'Search';
				_exactag.product_id = tools.getAttributeList(context.products, 'id');
				_exactag.search_query = tools.wrap(PageContext.get('search.searchPhrase'));
				_exactag.product_qty_sum = tools.wrap(context.search.count);
				break;

			// *************
			// category
			// *************
			case globalAvailablePages.categoryshow:
				_exactag.sitegroup = 'Category';
				_exactag.category_id = tools.wrap(context.category.id);
				_exactag.category_name = tools.wrap(context.category.displayName);
				_exactag.product_id = tools.getAttributeList(context.products, 'id');
				break;

			// *************
			// productdetails
			// *************
			case globalAvailablePages.productdetails:
			case globalAvailablePages.productquickview:


				if(context.product.isProductSet) {
					// produkt-set SPV
					_exactag.sitegroup = 'shopbylook';

				} else {
					// regular SPV
					_exactag.sitegroup = 'Product';
					_exactag.category_id = tools.wrap(PageContext.get('category.id'));
					_exactag.category_name = tools.wrap(PageContext.get('category.displayName'));
					_exactag.product_brand = tools.wrap(context.product.brand);
					_exactag.product_id = tools.wrap(context.product.id);
					_exactag.product_ean = tools.wrap(context.product.ean);
					_exactag.product_name = tools.wrap(context.product.name);
					_exactag.product_price = tools.wrap(context.product.netPrice.eurValue);
					_exactag.product_onsale = tools.wrap(context.product.onSale ? '1' : '0');
					if (context.product.netListPrice != undefined) {
						_exactag.product_price_old = tools.wrap(context.product.netListPrice.eurValue);
					}
				}
				break;


			// *************
			// add to Cart
			// *************
			case globalAvailablePages.cocartaddproduct:

				_exactag.sitegroup = 'AddToCart';
				_exactag.category_id = tools.wrap(PageContext.get('category.id'));
				_exactag.category_name = tools.wrap(PageContext.get('category.displayName'));
				_exactag.product_brand = tools.wrap(context.product.brand);
				_exactag.product_id = tools.wrap(context.product.id);
				_exactag.product_ean = tools.wrap(context.product.ean);
				_exactag.product_name = tools.wrap(context.product.name);
				_exactag.product_price = tools.wrap(context.product.netPrice.eurValue);
				_exactag.product_onsale = tools.wrap(context.product.onSale ? '1' : '0');
				if (context.product.netListPrice != undefined) {
					_exactag.product_price_old = tools.wrap(context.product.netListPrice.eurValue);
				}

				break;


			// *************
			// add to wishlist
			// *************
			case globalAvailablePages.myaccountwishlist:
			case globalAvailablePages.myaccountwishlistadd:
			case globalAvailablePages.myaccountwishlistremove:
			case globalAvailablePages.wishlistadd:
			case globalAvailablePages.wishlistremove:

				// cv1whishlist
				var productObject = null;
				jQuery.each(context.cv1wishlist.items,function(key,product) {
					productObject = product;
					return false;
				});

				if (!empty(productObject)) {

					// show wishlist first product
					_exactag.sitegroup = 'Merkzettel';
					_exactag.product_id = tools.wrap(productObject['pid']);

				} else {

					// wishlist Empty
					_exactag.sitegroup = 'Information';
				}
				break;

			// *************
			// page / content page
			// *************
			case globalAvailablePages.page:
				if(context.content.cid != undefined && context.content.cid == 'NEWSLETTER_SUBSCRIPTION_DONE') {
					_exactag.sitegroup = 'Newsletter';
					_exactag.level = 'Newsletter';
					_exactag.orderid = '';
				} else {
					_exactag.sitegroup = 'Information';
				}
				break;

			// *************
			// cartshow
			// *************
			case globalAvailablePages.cocart:
			case globalAvailablePages.cocartaddmultipleproducts:
				_exactag.sitegroup = 'Basket';
				_exactag.category_id = tools.getAttributeList(context.basket.allProductLineItems, 'categoryId');
				_exactag.category_name = tools.getAttributeList(context.basket.allProductLineItems, 'categoryName');
				_exactag.product_id = tools.getAttributeList(context.basket.allProductLineItems, 'id');
				_exactag.product_name = tools.getAttributeList(context.basket.allProductLineItems, 'name');
				_exactag.product_price = tools.getAttributeList(context.basket.allProductLineItems, 'netPrice.eurValue');
				var quantities = jQuery.map(context.basket.allProductLineItems,jQuery.proxy(tools.getProperty,null,'quantity'));
				_exactag.product_qty = tools.wrap(quantities);
				_exactag.product_qty_sum = 0;
				jQuery.each(quantities, function(){_exactag.product_qty_sum += this;});
				_exactag.product_qty_sum = _exactag.product_qty_sum.toString();
				break;

			// *************
			// checkout: login
			// *************
			case globalAvailablePages.cologin:
				_exactag.sitegroup = 'Checkout-Login';
				break;

			// *************
			// checkout: shipping
			// *************
			case globalAvailablePages.coshipping:
				_exactag.sitegroup = 'Checkout-1';
				break;

			// *************
			// checkout: billing
			// *************
			case globalAvailablePages.cobilling:
				_exactag.sitegroup = 'Checkout-2';
				break;

			// *************
			// checkout: summary
			// *************
			case globalAvailablePages.cosummary:
				_exactag.sitegroup = 'Checkout-3';
				break;

			// *************
			// order confirmation
			// *************
			case globalAvailablePages.coconfirmation:
				_exactag.sitegroup = 'Conversion Sale';
				_exactag.orderid = tools.wrap(context.order.orderNo);
				_exactag.orderid_hashed = tools.wrap(context.order.orderNoHashed);
				_exactag.cuid = tools.wrap(context.customer && context.customer.id ? context.customer.id : '');
				_exactag.category_id = tools.getAttributeList(context.order.allProductLineItems, 'categoryId');
				_exactag.category_name = tools.getAttributeList(context.order.allProductLineItems, 'categoryName');
				_exactag.product_id = tools.getAttributeList(context.order.allProductLineItems, 'id');
				var brands = new Array();
				jQuery.each(context.order.allProductLineItems, function(i, lineItem){
					if (!empty(lineItem.trackingInformation) && lineItem.trackingInformation.brandName != undefined) {
						brands.push(lineItem.trackingInformation.brandName);
					} else {
						brands.push(context.global.constants.brand.name);
					}
				});
				_exactag.lead_brand = tools.wrap(brands);
				_exactag.product_name = tools.getAttributeList(context.order.allProductLineItems, 'name');
				_exactag.product_size = tools.getAttributeList(context.order.allProductLineItems, 'size');
				_exactag.product_price = tools.getAttributeList(context.order.allProductLineItems, 'netPrice.eurValue');
				var quantities = jQuery.map(context.order.allProductLineItems,jQuery.proxy(tools.getProperty,null,'quantity'));
				_exactag.product_qty = tools.wrap(quantities);
				_exactag.product_qty_sum = 0;
				jQuery.each(quantities, function(){_exactag.product_qty_sum += this;});
				_exactag.product_qty_sum = _exactag.product_qty_sum.toString();
				_exactag.totalprice = tools.wrap(context.order.totalNetPrice.eurValue);
				_exactag.totalprice_brutto = tools.wrap(context.order.totalGrossPrice.eurValue);
				_exactag.shipping = tools.wrap(context.order.adjustedShippingTotalNetPrice.eurValue);
				_exactag.currency = tools.wrap(context.order.totalGrossPrice.eurCurrencyCode);
				_exactag.voucher = tools.wrap(context.order.coupons.length > 0 ? '1' : '0');
				if (context.order.rmfIsNewCustomer != undefined) {
					_exactag.customer_type = _exactag.level = tools.wrap(context.order.rmfIsNewCustomer == true ? 'neukunde' : 'bestandskunde');
				}
				if (context.order.payments.length > 0 ){
					_exactag.payment = tools.wrap(context.order.payments[0]['method']);
				} else {
					_exactag.payment = ''
				}
				break;

			// *************
			// order confirmation
			// *************
			case globalAvailablePages.coregisterconfirmation:
				// no tracking on register confirmation page
				return;

			// *************
			// Other Pages
			// *************
			default:
				_exactag.sitegroup = 'Information';
				// end define conversion parameter

			} // Switch End

			// get hashed email for all page types
			if(context.customer && context.customer.hashedMail) {
				_exactag.hashed_email = tools.wrap( context.customer.hashedMail );
				_exactag.hashed_email_2 = tools.wrap( context.customer.hashedMail ); // was the old sha256-md5 value
			}

			// get voucher codes from order if exists
			if(context.order.coupons && context.order.coupons.length > 0) {
				_exactag.voucher_code = tools.getAttributeList(context.order.coupons, 'couponCode');
			}
			// get voucher codes from basket if exists
			if(context.basket.coupons && context.basket.coupons.length > 0) {
				_exactag.voucher_code = tools.getAttributeList(context.basket.coupons, 'couponCode');
			}

			// additional url trackings for referrer tracking
			try {
				var _externalReferrer = JSON.parse(window.sessionStorage.getItem('externalReferrer'));
				if(_externalReferrer && _externalReferrer.isSent == false) {
					_externalReferrer.isSent = true;
					_exactag.referrer = _externalReferrer.referrer;
					var locationParts = URLTools.getParts(_externalReferrer.location);
					_exactag.host = locationParts.host;
					_exactag.site = locationParts.pathname;
					_exactag.search = locationParts.search;
					_externalReferrer.referrer = '';
					_externalReferrer.location = '';
				}

				window.sessionStorage.setItem('externalReferrer', JSON.stringify(_externalReferrer));
			} catch(e){}

			track(_exactag);
		};

		var log = function _log(_exactag) {
			if(enableLog) {
				AppLog.info('Exactag Tracking V2: ',_exactag);
			}
		};

		var dummyTrack = function _dummyTrack() {
			log(_exactag);
		};

		var _ucDeferred = new Deferred();
		if(typeof(MMS.UserCentrics) == 'undefined') {
			MMS.EventMgr.register(document, 'mms:usercentrics:loaded', _ucDeferred.resolve, {once : true});
		}
		else {
			_ucDeferred.resolve();
		}

		var track = function _track(_exactag) {
			_ucDeferred.promise.then(function() {
				MMS.UserCentrics.onReady().then(function() {
					if(!MMS.UserCentrics.isExactagEnabled()) {
						AppLog.info('Exactag Tracking V2: disabled by UserCentrics consent');
						return;
					}

					// ========================================================
					// USERCENTRICS - ARP - COMPATIBILITY: START

					var categoryMapping = MMS.LocalConstants.get('userCentrics.categoryMapping');
					var services = UC_UI.getServicesBaseInfo();
					var categorySlug;
					var consentGiven;
					var arpChannel;

					// pre-init all arp-channels. Default to true.
					Object.keys(categoryMapping).forEach(function(slug) {
						arpChannel = categoryMapping[slug];
						if(arpChannel.indexOf('marketing') == -1) {
							return;
						}
						_exactag[arpChannel] = true;
					});

					// iterate the services. if one service per category is disabled, deny the whole category.
					services.forEach(function(service) {
						categorySlug = service.categorySlug;
						consentGiven = service.consent.status;
						if(MMS.Object.isEmpty(categorySlug)) {
							return;
						}
						arpChannel = categoryMapping[categorySlug];
						if(MMS.Object.isEmpty(arpChannel) || arpChannel.indexOf('marketing') == -1) {
							return;
						}

						_exactag[arpChannel] = _exactag[arpChannel] && consentGiven;
					});

					// USERCENTRICS - ARP - COMPATIBILITY: END
					// ========================================================

					// else:
					if (PageContext.get('global.instanceType') != 'prd') {
						// additional dummy tracking needed by test automation
						var exactagJSON = JSON.stringify(_exactag);
						var dummyURL = PageContext.getFirst().global.staticImageURL.replace('images','js') + 'trackingblank.js';
						dummyURL += '?exactag=' +  encodeURIComponent(exactagJSON);
						CoreUtils.loadExternalScript(dummyURL, function(){return true;}, dummyTrack);

						// add isTest parameter
						_exactag.isTest = 'true';
					}
					exactag.track(_exactag);
				});
			});
		};

		CoreUtils.loadExternalScript('//cdn.exactag.com/js/exactag.js',
			function(){
				if(typeof(exactag)!= 'undefined'){
					return false;
				}
			},doExacTagTracking);
	});
	
	/* ]]> */
// -->


