Summary
Firing MadSpend events such as Qualified Conversion  and Purchase through Google Tag Manager can:

  1. Tell Facebook what leads would convert, which trains the Facebook AI with the predicted lead values (see MadSpend use case), and
  2. Help track your Facebook leads through the entire funnel.

The summary of steps include:
(1) Ensure you have a data layer variable set up
(2) Set up a trigger
(3) Set up the Custom HTML tag firing the event

Setup steps 

Step #1: Ensure you have a data layer variable set up

  1. Navigate to the Variables tab
  2. Create a new Variable
  3. Ensure the new Variable is based on the Data Layer Variable
  4. Select event as the Data Layer Variable name

Step #2: Set up a trigger

  1. Navigate to the Triggers tab
  2. Create a new Trigger
  3. Ensure the new Trigger is configured as a Custom Event
  4. Select the event name when your forms are being clicked on or submitted 

Step #3: Set up the Custom HTML tag firing the event

  1. Navigate to the Tags tab
  2. Create a new Tag
  3. Ensure the new Tag is configured as a Custom HTML tag
  4. Enter the following script below into the Custom HTML field
  5. Ensure you select the trigger you created in Step #2

The script is as follows:


<script>
// get all computed attributes from MadKudu
var traits = madkudu.user().traits();
// get the predicted lead value
var mk_value = traits.predicted_value
// send the predicted value back to facebook as a conversion
var call = {currency: "USD", value: mk_value };
if(mk_value){  fbq('track', 'Purchase', call);
</script>


Did this answer your question?