Sign in

Welcome to our Support Center

Get help with integration and live campaigns

Welcome to our Support Center. Get help with integration and live campaigns

I offer multiple payment methods

Overview

The Criteo OneTag must be installed on the Order Confirmation page of your website regardless of the payment method selected by the user so that you can track the products bought. Tracking what the user buys allows Criteo to optimize the banner display, so that products bought by the user won't be displayed to them again. Proper implementation will also allow you to measure the ROI of your Criteo campaign.
If you have a different Order Confirmation page for each payment method, you need to make sure that the Criteo OneTag is implemented and working on them all.
The Criteo OneTag should be implemented within the header code of your site. The tag loads asynchronously, so it will not interfere with the page loading time or user experience.

Transactions outside of your domain

If you offer any payment method where the transaction takes place outside of your domain (such as PayPal) you may find a significant number of your customers using that payment method are not being redirected back to your site. If they do not return to the Order Confirmation/Thank You page automatically, you might need to implement the Criteo OneTag on the Pay Now button that redirects to the external domain, so Criteo can capture the transaction.
The example below shows how to implement the Criteo OneTag on a button called "PayPal". There is just one function to be added:

The Criteo OneTag implemented on a button to track external sales

 <!-- //Criteo Loader -->
<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>

<!--............ -->

<script type="text/javascript">
function load_Criteo_OneTag(){
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{ event: "setAccount", account: YOUR UNIQUE ACCOUNT ID },
{ event: "setSiteType", type: "m FOR MOBILE OR t FOR TABLET OR d FOR DESKTOP" },
{ event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },
{ event: "trackTransaction", id: "TRANSACTION ID",
item: [ { id: "FIRST PRODUCT ID", price: FIRST PRODUCT UNIT PRICE, quantity: FIRST PRODUCT QUANTITY },
{ id: "SECOND PRODUCT ID", price: SECOND PRODUCT UNIT PRICE, quantity: SECOND PRODUCT QUANTITY }
/* add a line for each product in the user's basket */
]});
}
</script>

<!--............ -->

<button type="button" onclick="load_Criteo_OneTag()">PayPal</button>

How to avoid counting repeated transactions caused by multi-clicks

Sometimes users will double-click the Pay Now button that redirects to the external payment method. To avoid executing the Criteo OneTag each time the user clicks, you can add a variable that prevents the event from being executed more than once.
See the example below:

The Criteo OneTag implemented on a Sales Confirmation page with multi-click detection:

 <!-- //Criteo Loader -->
<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
<!-- // Declare the variable -->
<script type="text/javascript">
var cto_clicked = false;
</script>

<!--............ -->

<script type="text/javascript">
function load_Criteo_OneTag(){
if (!window.cto_clicked){
window.clicked = true;
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{ event: "setAccount", account: YOUR UNIQUE ACCOUNT ID },
{ event: "setSiteType", type: "m FOR MOBILE OR t FOR TABLET OR d FOR DESKTOP" },
{ event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },
{ event: "trackTransaction", id: "TRANSACTION ID",
item: [ { id: "FIRST PRODUCT ID", price: FIRST PRODUCT UNIT PRICE, quantity: FIRST PRODUCT QUANTITY },
{ id: "SECOND PRODUCT ID", price: SECOND PRODUCT UNIT PRICE, quantity: SECOND PRODUCT QUANTITY }
/* add a line for each product in the user's basket */
]});
}
}
</script>

<!--............ -->

<button type="button" onclick="load_Criteo_OneTag()">PayPal</button>

Generating a random Transaction ID

In the event that the order does not have an associated Transaction ID to pass into the Criteo OneTag when the user clicks on the Pay Now button, you can use this random function to generate one.

Random function:

 Math.floor(Math.random()*9999999) 

In the example below, this random function is combined with the prefix "Button_" in order to create a Transaction ID that is more easily identified. Where you use multiple payment options you can change the word "Button" for the method selected by the user. For example, if you implemented this code on a button which redirects to PayPal, you can use "PayPal_" instead of "Button_" so it is even easier to identify the transaction.
Note that the code below is just an extract of the trackTransaction event of the Criteo OneTag in order to highlight the portion relating to the Transaction ID.

The Criteo OneTag implemented on a Sales Confirmation page:

 <!--............ -->
{ event: "trackTransaction", id: "PayPal_" + Math.floor(Math.random()*9999999),
item: [ { id: "FIRST PRODUCT ID", price: FIRST PRODUCT UNIT PRICE, quantity: FIRST PRODUCT QUANTITY },
{ id: "SECOND PRODUCT ID", price: SECOND PRODUCT UNIT PRICE, quantity: SECOND PRODUCT QUANTITY }
/* add a line for each product in the user's basket */
]});
<!--............ -->

Examples of different payment methods

  • Credit/debit card
  • PayPal
  • Cheque
  • Bank transfer
  • Pay with Amazon

It is critical that Criteo tracks all transactions; not doing so will negatively affect your campaign's performance and your user's experience.
Failing to track transactions means that users will be shown irrelevant banners with recommendations that include products previously purchased. You will also be unable to properly measure Criteo's performance.

Was this article helpful?
1 out of 1 found this helpful
Powered by Zendesk