Config Pixel Purchase in Google Tag Manager

  1. Install Pixel base
    Add this line to tell Tag Manager this tag is loaded.

    window.google_tag_manager[{{Container ID}}].onHtmlSuccess({{HTML ID}});

    Image 4

  2. Get ready your advanced ecommerce datalayer of google
  3. Create a variable (Custom javascript) called “Transform Total for Pixel” to transform data from datalayer for pixel purchase event
    function(){
    	try{
    		var products = google_tag_manager[{{Container ID}}].dataLayer.get("ecommerce").purchase.products;
    		var productIds = [];
    		
    		for(i = 0; i < products.length; i++){
    			productIds.push(products[i].id);
    		}
    		
    		return productIds;
    	}catch(e){
    		return 'undefined';
    	}
    }
  4. Create a new Tag – Purchase (Custom HTML)
    Image 2
    Image 3
  5. Config trigger (Recommended triggered by event instead of page view)
    Image 5

Reference