Facebook Pixel with Multiple Dynamic value Tracking | Ahsan Taz

Step-1: Trigger for purchase event for WordPress

Event Name (Taken from Data layer): gtwpm4.orderCompletedEEC

Step-2: Create Data layer variable for pushing Purchase value 

Data layer Variable Name(Taken from Data layer): ecommerce.purchase.actionField.revenue

dlv – FB – Purchase value

 

Step-3: Create Data Layer Variable for Products (Multiple items)

Data layer Variable name: ecommerce.purchase.products

dlv – FB – Purchase Product

Step-4: Create Custom JavaScript Variable to push multiple products info from Array 

jsv – FB – Purchase Product – AR

 

Code: 

function() {

  var products = {{dlv – FB – Purchase Product}};

  return products.map(function(prod) { return prod.id; });

}

 

Step-5: Create tag and finally test from preview mode

 

Code: 

Purchase Tag

 

 

Reference: #GTMTips: Create String From Multiple Object Properties | Simo Ahava’s blog

View Content Event: 

 

Create Data Layer Variable:

 

dlv – fb – product id : ecommerce.detail.products.0.id

dlv – fb – product price : ecommerce.detail.products.0.price

 

dlv – fb – product name : ecommerce.purchase.products.0.name

 

dlv – fb – currency : ecommerce.currencyCode

 

Trigger:

Event: gtm.dom

or

Page URL: /product/

Add to cart Event: 

Data Layer Variable:

 

dlv – fb – product id : ecommerce.detail.products.0.id

dlv – fb – product price : ecommerce.detail.products.0.price

 

dlv – fb – product name : ecommerce.detail.products.0.name

 

dlv – fb – currency : ecommerce.currencyCode

Trigger:

Event: gtm4wp.addProductToCartEEC

Still, facing difficulties?


Hire Me

Write a Comment

Your email address will not be published. Required fields are marked *