I’m looking to integrate tracking from the affiliate program commission junction.
They have provided me with the following sample code to add to my order received page, any help would be appreciated regarding how to place this in /order-received/ endpoint and the modifications its asking for. I’m absolutely lost, there are plugins for several similar programs.
(They offer a javascript and asp alternative by the looks of things if that helps)
<!-- BEGIN COMMISSION JUNCTION TRACKING CODE -->
<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.emjcd.com/tags/c?containerTagId=14209&ITEMx=[ItemSku]&AMTx= [AmountofItem]&QTYx=[Quantity]&CID=1529328&OID=[OID]&TYPE=385769&AMOUNT=[Subtotal]&DISCOUNT=[DiscountAmount]&CURRENCY=[CURRENCY]&COUPON=[couponcode]" name="cj_conversion" ></iframe>
<!-- END COMMISSION JUNCTION TRACKING CODE -->
Add the following code in your themes functions.php file
Looking at your tracking code, I am having a guess that we may need to fill the src url with correct values. But i am not sure.
You’ll need to list out all of the SKUs purchased along with their prices. If you want you can use the
DISCOUNT
parameter to apply a dollar discount to the order, unless you’re already deducting discounts in the price you put in the iframe. Coupon code is also a nice-to-have.If you want to do this in JavaScript and assuming your order data is in an array of objects that looks like the dummy data below here’s how you’d do that in JavaScript: