Add to/Remove from Favorites (GTM)

When a user adds a product to Favorites / Wishlist; a custom HTML GTM tag with a content like below is need to be triggered.

<script type="text/javascript">
	function rdAddtoFav(){
		var vl = new Visilabs();
		vl.AddParameter("OM.pf","Product Code");
		vl.AddParameter("OM.pfu","1");
		vl.AddParameter("OM.ppr","Price of the product");
		vl.Collect();
	}
	rdAddtoFav();
</script>

When a user removes a product to Favorites / Wishlist; a custom HTML GTM tag with a content like below is need to be triggered.

<script type="text/javascript">
	function rdRemoveFromFav(){
		var vl = new Visilabs();
		vl.AddParameter("OM.pf","Product Code");
		vl.AddParameter("OM.pfu","-1");
		vl.AddParameter("OM.ppr","Price of the product");
		vl.Collect();
	}
	rdRemoveFromFav();
</script>

Important Notes

- This tag needs to be triggered after the event named visilabs_loaded.

Product attributes that are taken as parameters for this event needs to be available on dataLayer array.



Parent Topic: Events Triggered with User Actions

Copyright 2020 Related Digital