<{if $product && $webshop->getEnableTracking() && $webshop->getUseEvents() && $cookie.accept_cookies == 'accept'}>

	 <{capture name="item_names"}><{strip}>
		 <{section name="i" loop=$basket}>
		 	<{assign var="p" value=$basket[i].product}>
		 	"<{$p->getName()|escape}>"<{if !$smarty.section.i.last}>,<{/if}>
		 <{/section}>
	 <{/strip}><{/capture}>

	 <{capture name="added_item_categories"}><{strip}>
		 <{assign var="categories" value=$product->getCategories()}>
		 <{section name="i" loop=$categories}>
		 	"<{$categories[i]->getName()|escape}>"<{if !$smarty.section.i.last}>,<{/if}>
		 <{/section}>
	 <{/strip}><{/capture}>

	 <{assign var="image" value=$product->getImage()}>

	<script type="text/javascript">
		$(document).ready(function() {

		var show = true;

		if ('<{$type}>' == 'product' && window.location.hash != '#added') {
			show = false;
		}

		_learnq.push(["track", "Added to Cart", {
		     "$value": <{$total_price|number_format:2:".":""}>,

		     "AddedItemProductName": "<{$product->getName()|escape}>",
		     "AddedItemProductID": "<{$product->getProductId()}>",
		     "AddedItemSKU": "<{$product->getOwnId()|escape}>",
		     "AddedItemCategories": [<{$smarty.capture.added_item_categories}>],
		     "AddedItemImageURL": "<{if $image}><{$webshop->getUrl()|escape}><{$image->getSrc(500, 500, 'fit')}><{/if}>",
		     "AddedItemURL": "<{$product->getRemoteUrl()|escape}>",
		     "AddedItemPrice": <{$product->getRealPrice()|number_format:2:".":""}>,
		     "AddedItemQuantity": 1,
		     "ItemNames": [<{$smarty.capture.item_names}>],
		     "CheckoutURL": "<{$webshop->getUrl()|escape}>/basket",

		     "Items": [
				<{section name="i" loop=$basket}>
					<{assign var="p" value=$basket[i].product}>
				 	<{assign var="image" value=$p->getImage()}>
					<{capture name="product_categories"}><{strip}>
						<{assign var="categories" value=$p->getCategories()}>
					 	<{section name="j" loop=$categories}>
					 		"<{$categories[j]->getName()|escape}>"<{if !$smarty.section.j.last}>,<{/if}>
						<{/section}>
					<{/strip}><{/capture}>

					 {
			         "ProductID": "<{$p->getProductId()}>",
			         "SKU": "<{$p->getOwnId()|escape}>",
			         "ProductName": "<{$p->getName()|escape}>",
			         "Quantity": <{$basket[i].amount}>,
			         "ItemPrice": <{$product->getRealPrice(1, $basket[i].attributes)|number_format:2:".":""}>,
			         "RowTotal": <{$product->getRealPrice($basket[i].amount, $basket[i].attributes)|number_format:2:".":""}>,
			         "ProductURL": "<{$product->getRemoteUrl()|escape}>",
			         "ImageURL": "<{if $image}><{$webshop->getUrl()|escape}><{$image->getSrc(500, 500, 'fit')}><{/if}>",
			         "ProductCategories": [<{$smarty.capture.product_categories}>]
				 	}
				 	<{if !$smarty.section.i.last}>,<{/if}>
				<{/section}>
		     ]
		   }]);

	   });

	</script>

<{/if}>