Push customer data to Crisp CRM automatically

In class.order.php

Find

// Show the order confirmation screen

Add above

$oid = $order['orderid'];
$ofn = $order['ordbillfirstname'];
$oln = $order['ordbilllastname'];
$oem = $order['ordbillemail'];    
$GLOBALS['SubscriptionCrisp'] = "<script>\$crisp.push([\"set\", \"user:email\", [\"$oem\"]]);\$crisp.push([\"set\", \"user:nickname\", [\"$ofn $oln\"]]);\$crisp.push([\"set\", \"session:data\", [\"Order\", \"$oid\"]]);</script>";

In order.html (both Desktop and Mobile templates)

Find

%%GLOBAL_ConversionCode%%

Add after

 %%GLOBAL_SubscriptionCrisp%% 

Result

<script>
$crisp.push(["set", "user:email", ["your@email.com"]]);
$crisp.push(["set", "user:nickname", ["Your Name"]]);
$crisp.push(["set", "session:data", ["Order", "123456"]]);
</script>

Leave a Reply

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