steveosoule
2/4/2015 - 10:14 PM

Miva - JavaScript Data Layer

Miva - JavaScript Data Layer

<script id="mv-data-layer">
	<mvt:assign name="g._customer" value="g.customer" />
	<mvt:assign name="g._customer:password" value="''" />
	<mvt:assign name="l.settings:_product" value="l.settings:product" />
	<mvt:assign name="l.settings:_product:descrip" value="''" />
	<mvt:assign name="l.settings:_product:descrip_nohtml" value="''" />
	var mvDataLayer = {
		g: {
			"screen": "&mvte:global:Screen;",
			"action": "&mvte:global:Action;"
		},
		store: {
			"code": "&mvte:store:code;",
			"company": "&mvte:store:company;",
			"country": "&mvte:store:country;",
			"email": "&mvte:store:email;"
		},
		page: <mvt:item name="ry_toolbelt" param="eval|Json_Stringify(l.all_settings:page)" />,
		customer: <mvt:item name="ry_toolbelt" param="eval|Json_Stringify(g._customer)" />,
		order: <mvt:item name="ry_toolbelt" param="eval|Json_Stringify(l.all_settings:order)" />,
		product: <mvt:item name="ry_toolbelt" param="eval|Json_Stringify(l.all_settings:_product)" />,
		category: <mvt:item name="ry_toolbelt" param="eval|Json_Stringify(l.all_settings:category)" />
	}
</script>
<script id="mv-data-layer-basket">
	mvDataLayer.basket = <mvt:item name="ry_toolbelt" param="eval|Json_Stringify(l.all_settings:basket)" />;
	mvDataLayer.g.basket = <mvt:item name="ry_toolbelt" param="eval|Json_Stringify(g.basket)" />;
	mvDataLayer.global_minibasket = <mvt:item name="ry_toolbelt" param="eval|Json_Stringify(l.all_settings:global_minibasket)" />;
</script>