---
title: 'Impostazioni avanzate di Criteo OneTag'
description: 'Per abilitare un certo numero di impostazioni avanzate, vi sono diverse modifiche che puoi attuare alla tua implementazione di Criteo OneTag. Queste servono…'
language: it
guide: M2TiX6m90K
updated: 2025-11-12T13:21:16Z
canonical: https://help.criteo.com/kb/guide/it/impostazioni-avanzate-di-criteo-onetag-M2TiX6m90K/Steps/886908
alternates:
  de: https://help.criteo.com/kb/guide/de/erweiterte-einstellungen-von-criteo-onetag-M2TiX6m90K.md
  en: https://help.criteo.com/kb/guide/en/criteo-onetag-advanced-settings-M2TiX6m90K.md
  es: https://help.criteo.com/kb/guide/es/configuracion-avanzada-de-criteo-onetag-M2TiX6m90K.md
  fr: https://help.criteo.com/kb/guide/fr/parametres-avances-de-criteo-onetag-M2TiX6m90K.md
  ja: https://help.criteo.com/kb/guide/ja/criteo-tag-M2TiX6m90K.md
  ko: https://help.criteo.com/kb/guide/ko/criteo-onetag-M2TiX6m90K.md
  pt: https://help.criteo.com/kb/guide/pt/configuracoes-avancadas-da-criteo-onetag-M2TiX6m90K.md
  zh: https://help.criteo.com/kb/guide/zh/criteo-onetag-M2TiX6m90K.md
---

> Index of this knowledge base: https://help.criteo.com/llms.txt
>
> Interactive version: https://help.criteo.com/kb/guide/it/impostazioni-avanzate-di-criteo-onetag-M2TiX6m90K/Steps/886908

# Impostazioni avanzate di Criteo OneTag

<a id="step-886908"></a>

## Impostazioni avanzate di Criteo OneTag

Per abilitare un certo numero di impostazioni avanzate, vi sono diverse modifiche che puoi attuare alla tua implementazione di Criteo OneTag.  
  
Queste servono per il cross-device targeting, gli inserzionisti con più valute/Paesi e altri punti. Leggi l’indice qui sotto per avere istruzioni su come trarre il meglio dal tuo lavoro di configurazione.

- If "Configurazione dell’evento cross-device": [Passa le e-mail con hash tramite l'evento cross-device](#step-887075)
- If "Pass phone numbers with OneTag": [Pass phone numbers with OneTag](#step-4106561)
- If "Configurazione dell’evento per diversi tipi di sito": [Configurazione dell’evento per diversi tipi di sito](#step-887074)
- If "Configurazione dell’evento per più Paesi": [Configurazione dell’evento per più Paesi](#step-887076)
- If "Configurazione dell’evento per più valute": [Configurazione dell’evento per più valute](#step-887079)
- If "Configurazione dell’evento per più siti Web che utilizzano lo stesso carrello": [Configurazione dell’evento per più siti Web che utilizzano lo stesso carrello](#step-887071)
- If "Configurazione dell’evento per più tipi di pagamento": [Configurazione dell’evento per più tipi di pagamento](#step-887073)
- If "Configurazione dell’evento per inserzionisti del travel": [Configurazione dell’evento per inserzionisti del travel](#step-887078)
- If "Meno/più di 3 ID Prodotto nel Criteo OneTag sulle pagine dei risultati di ricerca": [Meno/più di 3 ID Prodotto nel Criteo OneTag sulle pagine dei risultati di ricerca](#step-887077)
- If "Configurazione dell’integrazione di netID": [Configurazione dell’integrazione di netID](#step-887072)

<a id="step-887075"></a>

## Passa le e-mail con hash tramite l'evento cross-device

L'implementazione del parametro cross-device all'interno di Criteo OneTag è essenziale per:

-   Raggiungere oggi un pubblico indirizzabile su Safari e Firefox e prepararsi per il ritiro dei cookie di terze parti su Chrome.
    
-   Abilitazione delle funzionalità cross-device: se un potenziale cliente sta navigando sui prodotti del tuo sito web dal proprio dispositivo mobile, questo parametro consente di mostrare successivamente a questo cliente annunci pertinenti sul proprio dispositivo desktop.
    
-   Migliorare i tassi di corrispondenza quando carichi elenchi di contatti su Commerce Growth o invii tramite API.
    

**Come funziona**

Il parametro cross-device è un piccolo snippet di codice che ti consente di passare gli indirizzi e-mail con hash dei visitatori al tuo sito web. Tutti gli indirizzi e-mail verranno sottoposti a hash, utilizzando un algoritmo SHA-256, prima di essere archiviati sui server di Criteo. Criteo utilizzerà quindi il valore hash per abbinare gli utenti su ciascuno dei loro dispositivi.  
  
Per garantire la protezione della privacy dei tuoi clienti, Criteo memorizzerà solo gli indirizzi e-mail con hash dei tuoi clienti sui nostri server.  

**Devo aggiornare l'informativa sulla privacy del mio sito web?**

È necessario assicurarsi che l'Informativa sulla privacy del sito Web informi chiaramente i visitatori del sito Web che gli indirizzi e-mail possono essere raccolti e condivisi con terze parti con cui si collabora per ottimizzare le prestazioni della campagna e che queste informazioni vengono sottoposte a hash utilizzando la tecnologia di hash SHA256 più recente e sicura.

Inoltre, dovresti informare i tuoi visitatori che rispetti la loro privacy e, se preferiscono non condividere tali informazioni, possono farlo selezionando le loro opzioni preferite nel banner di conformità ai cookie dell'utente del tuo sito web (CMP).

Per ulteriori informazioni, fare riferimento [all'Informativa sulla privacy di Criteo](https://help.criteo.com/kb/guide/en/the-criteo-privacy-promise-pDIW4yiawH/Steps/775742) e includere il collegamento fornito nella sezione Informativa sulla privacy del proprio sito Web.

> **Tip:** Se il tuo team legale ha dei dubbi relativi alla privacy, può contattare il tuo contatto commerciale Criteo che lo metterà in contatto con il nostro team legale, se necessario.

**Come implementare il parametro cross-device**

Per offrirti la massima flessibilità, Criteo accetta gli indirizzi e-mail degli utenti in questi formati:

-   **SHA256 hash** (in linea con gli standard del settore per la pubblicità indirizzabile).
    
-   Hashing **MD5** o **SHA256MD5** (metodi legacy di Criteo).
    
-   **Testo normale** (in seguito utilizzeremo la crittografia SHA256 sulle e-mail).
    

> **Tip:** **Nota** : Criteo sta migrando dall'hashing delle nostre e-mail tramite MD5/SHA256MD5 a SHA256. Per massimizzare i tassi di corrispondenza tra i tuoi dati e il nostro grafico dell'identità, in particolare durante il periodo di migrazione, **condividi i formati legacy (MD5 o SHA256MD5) insieme al nuovo formato SHA256** .
>
> Se non riesci a condividere entrambi, **dai la priorità al formato SHA256** .
>
> Se condividi testo normale, non è richiesto alcun aggiornamento.

Maggiori dettagli su ciascun metodo di implementazione del parametro cross-device:

- If "SHA256 e MD5 (preferito)": [SHA256 e MD5 (preferito)](#step-1948825)
- If "SHA256 hash": [SHA256 hash](#step-1948824)
- If "Testo normale": [Testo normale](#step-1948817)
- If "MD5 o SHA256MD5 (legacy)": [MD5 o SHA256MD5 (legacy)](#step-1950390)
- If "Funzioni di hashing": [Funzioni di hashing](#step-1948827)
- If "FAQ": [FAQ](#step-1948826)

<a id="step-4106561"></a>

## Pass phone numbers with OneTag

Phone numbers, as well as e-mails, are one of the biggest sources of identity information. In order to maximize our identification capabilities, we decided to accept them as well as an user identifier, as in some regions (APAC or US, for example) they are very representative and easier to share than e-mail addresses or other identifiers.

To improve our compatibility with already established standards in the industry, we have decided to enable phone number collection through Criteo's OneTag. Some of the upsides of sharing phone numbers are:

-   HPN (hashed phone number) is the best representation of a **single user and it persists over time**: In general, people have a single persistent phone number whereas they may have several emails, mobile ids or cookies. 
    
-   HPN improves **our 360 vision of the user**: a user has a single phone number, available for each of his devices. It helps us improve our bidding, our recommendation and thus the performance for our clients. 
    
-   HPN **interoperates** with several identifiers including HEM and some alternative ids. We can:
    
    -   Collect HPN <> alternative ids links and bid directly on the alternative ids. 
        
    -   Collect HEM <> HPN and bid directly with the HEM.
        

**How it works**

We collect the data through a small snippet of code that allows you to pass the phone numbers of visitors to your website. Event though they can be collected in plain or hashed formats, all phone numbers will be hashed, using a SHA-256 algorithm, before being stored on Criteo's servers. Criteo will then use the hash value to match users across each of their devices.

To ensure we protect your customers’ privacy, Criteo will only store the hashed phone numbers of your customers on our servers. In order to be secure enough, we are adding a second hash stored in a secret vault to avoid any reidentification of the users.

**Do I need to update my website's privacy policy?**

You need to ensure your Website Privacy Policy clearly informs your website visitors that phone numbers may be collected and shared with third-parties that you collaborate with to optimize campaign performance and that this information is hashed using the latest and most secure SHA256 hashing technology.

Additionally, you should inform your visitors that you respect their privacy, and should they prefer not to share such information, they can do so by selecting their preferred options in your website user cookie compliance banner (CMP).

Please refer to [Criteo's Privacy Policy](https://help.criteo.com/kb/guide/en/the-criteo-privacy-promise-pDIW4yiawH/Steps/775742) for more information, and you may also include the provided link within your website's Privacy Policy section. 

Should your legal team have any concerns relating to privacy, they may reach out to your Criteo business contact who will connect them with our legal team as needed.

How to implement

To provide the most flexibility to you, Criteo accepts users' phone numbers in these formats:

-   **SHA256 hashed** (in line with industry standards for addressable advertising).
    
-   **Plain text** (we will, immediately before logging the data, use SHA256 encryption on the phone numbers).

- If "SHA256": [SHA256](#step-4106563)
- If "Plain Text": [Plain Text](#step-4106562)

<a id="step-887074"></a>

## Configurazione dell’evento per diversi tipi di sito

```javascript
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR_PARTNER_ID" async="true"></script>

<script type="text/javascript">

window.criteo_q = window.criteo_q || [];

var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

window.criteo_q.push(

    { event: "setAccount", account: YOUR UNIQUE ACCOUNT ID },

    { event: "setSiteType", type: deviceType },

    { event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },

    { event: "viewHome"}

);

</script>
```

Il parametro dinamico setSiteType è presente in Criteo OneTag integrato a ogni pagina del tuo sito. Se il tuo sito ha diverse versioni per supportare una gamma di dispositivi, indica quale versione viene visualizzata all’utente mediante il parametro "**setSiteType**":  

-   **d** per desktop
-   **m** per mobile
-   **t** per tablet

Esempi:  
  
parametro setSiteType sulla versione desktop di un sito:

 { event: "setSiteType", type: "d" },

  
parametro setSiteType sulla versione mobile di un sito: 

 { event: "setSiteType", type: "m" },

  
parametro setSiteType sulla versione tablet di un sito:  
 

{ event: "setSiteType", type: "t" },

Se non sei in grado di inviare questo valore dinamicamente, puoi utilizzare lo script che segue per rilevare automaticamente se l’utente è su desktop, mobile o tablet:  
 

var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

Quindi, devi collocare la variabile **deviceType** nell’evento. Cosicché il parametro "**setSiteType**" appaia così:

 { event: "setSiteType", type: deviceType },

E in modo che il l’evento Home page appaia così, ad esempio:

<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR\_PARTNER\_ID" async="true"></script>

<script type="text/javascript">

window.criteo\_q = window.criteo\_q || \[\];

var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

window.criteo\_q.push(

    { event: "setAccount", account: YOUR UNIQUE ACCOUNT ID },

    { event: "setSiteType", type: deviceType },

    { event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },

    { event: "viewHome"}

);

</script>

This path ends here.

<a id="step-887076"></a>

## Configurazione dell’evento per più Paesi

```javascript
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR_PARTNER_ID" async="true"></script>
<script type="text/javascript"> 
    window.criteo_q = window.criteo_q || []; var criteo_ID = #Country Account ID#; 
    var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d"; 
    window.criteo_q.push(          
        { event: "setAccount", account: criteo_ID },          
        { event: "setSiteType", type: deviceType  },          
        { event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },                  
        { event: "viewHome"}  ); 
</script>
```

Se il tuo sito Web vende prodotti ai clienti di più di un Paese, devi poter passare dinamicamente l’**ID Account** tra i diversi Paesi.   

Nell’esempio qui sotto, vedrai che è stata aggiunta all’evento Home page un’ulteriore variabile **criteo\_ID**. Il valore di questa variabile deve essere aggiornato dinamicamente sullo specifico **#Country Account ID#**, in base al Paese che l’utente seleziona. Questa logica deve essere aggiunta a ciascuna istanza del Criteo OneTag sul tuo sito Web.

Esempio di ID Account specifico per Paese implementato sul Criteo OneTag:

<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR\_PARTNER\_ID" async="true"></script>

<script type="text/javascript">

window.criteo\_q = window.criteo\_q || \[\];

var criteo\_ID = #Country Account ID#;

var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

window.criteo\_q.push(

         { event: "setAccount", account: criteo\_ID },

         { event: "setSiteType", type: deviceType  },

         { event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },        

         { event: "viewHome"}

 );

</script>

This path ends here.

<a id="step-887079"></a>

## Configurazione dell’evento per più valute

Se gli utenti sono in grado di acquistare prodotti in diverse valute sul tuo sito Web, ad esempio, un sito Web di travel su cui gli utenti prenotano da tutto il mondo, è probabile che tu voglia definire la valuta del prodotto acquistare.   

  
Fare questo aiuta Criteo a visualizzare la valuta corretta della campagna nel reporting Criteo in modo da allinearlo al tuo.  
  
Dal momento che i prezzi dei prodotti vengono passati unicamente in eventi di Carrello e Transazione, questa funzione deve essere utilizzata unicamente per questi due eventi nel Criteo OneTag. Se vedi solo prodotti in un’unica valuta, questa funzione non deve essere utilizzata.  
  
La funzione accetta solo codici ISO validi di valute (fai riferimento alla pagina Web [https://www.iso.org/iso-4217-currency-codes.html](https://www.iso.org/iso-4217-currency-codes.html) per maggiori informazioni).

  
È necessario digitare una stringa valida di 3 lettere che corrispondano al codice della valuta (ad e. 'EUR', 'USD', 'JPY'...).

-   Codice valuta ISO
    -   stringa di 3 lettere
    -   codice valuta valido (ad es. "EUR", "USD", "BRL"...)
-   lettere maiuscole
    -   "JPY" è digitato correttamente, mentre "jpy" no.

**  
Modalità di utilizzo**

Popola con la stringa a 3 lettere della valuta che l’utente ha selezionato sul tuo sito. Il valore del prezzo deve essere il numero esatto che appare sul sito. Se l’utente seleziona USD e il prezzo è $100, il prezzo nel Criteo OneTag deve essere 100 e la valuta deve essere USD.  
  
**Sintassi**

Il parametro viene chiamato **valuta** e ha questo aspetto:

valuta: "JPY"  
  
Questo è un esempio del parametro nell’**evento Carrello**:

{ event: "viewBasket", currency : "JPY", item: \[

  { id: "1234", price: 10.2, quantity: 1 },

  { id: "2345", price: 11.2, quantity: 2 }

\]} 

  
E sull’**evento Vendite**:

{ event: "trackTransaction", id: "12345", currency : "JPY", item: \[

  { id: "1234", price: 10.2, quantity: 1 },

  { id: "2345", price: 11.2, quantity: 2 }

\]} 

  
 

**Modalità di test**

Apri lo strumento di debug del tuo browser, premendo F12. Cerca "criteo" nella scheda Rete, quindi naviga fino alla pagina Carrello o Conferma dell’ordine (dove hai implementato la funzione di valuta). Questo è quello che vedrai nei parametri della stringa di query

This path ends here.

<a id="step-887071"></a>

## Configurazione dell’evento per più siti Web che utilizzano lo stesso carrello

```javascript
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR_PARTNER_ID" async="true"></script>

 <script type="text/javascript">

 window.criteo_q = window.criteo_q || [];

var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

 window.criteo_q.push(

 { event: "manualFlush"},

 { event: "setAccount", account: TEST.COM ACCOUNT ID },

 { event: "setSiteType", type: deviceType },

 { event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },

 { event: "viewBasket", item: [ { id: "TEST.COM PRODUCT ID", price: TEST.COM UNIT PRICE, quantity: TEST.COM PRODUCT QUANTITY }

 /* add a line for each product in the user's basket */

 ]},

 { event: "flushEvents"},

 { event: "setAccount", account: EXAMPLE.COM ACCOUNT ID },

 { event: "setSiteType", type: deviceType },

 { event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },

 { event: "viewBasket", item: [ { id: "EXAMPLE.COM PRODUCT ID", price: EXAMPLE.COM UNIT PRICE, quantity: EXAMPLE.COM PRODUCT QUANTITY }

 /* add a line for each product in the user's basket */

 ]},

{ event: "flushEvents"}

);

</script>
```

Se gestisci più siti Web, che però condividono la stessa pagina Carrello, avrai bisogno di configurare un flusso manuale di eventi nel Criteo OneTag.   

  
Ad esempio, hai due siti Web, EXAMPLE.COM e TEST.COM, che condividono la stessa pagina di Carrello test.com/cart. Dovrai aggiungere l’evento **manualFlush** all’evento e **flushEvents** a ciascun sito Web aggiuntivo su cui si acquista,   
  
Esempio di flusso manuale implementato sul Criteo OneTag, sulla tua pagina Carrello:

<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR\_PARTNER\_ID" async="true"></script>

 <script type="text/javascript">

 window.criteo\_q = window.criteo\_q || \[\];

var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

 window.criteo\_q.push(

 { event: "manualFlush"},

 { event: "setAccount", account: TEST.COM ACCOUNT ID },

 { event: "setSiteType", type: deviceType },

 { event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },

 { event: "viewBasket", item: \[ { id: "TEST.COM PRODUCT ID", price: TEST.COM UNIT PRICE, quantity: TEST.COM PRODUCT QUANTITY }

 /\* add a line for each product in the user's basket \*/

 \]},

 { event: "flushEvents"},

 { event: "setAccount", account: EXAMPLE.COM ACCOUNT ID },

 { event: "setSiteType", type: deviceType },

 { event: "setEmail", email: "TRIMMED AND LOWERCASE USER EMAIL ADDRESS" },

 { event: "viewBasket", item: \[ { id: "EXAMPLE.COM PRODUCT ID", price: EXAMPLE.COM UNIT PRICE, quantity: EXAMPLE.COM PRODUCT QUANTITY }

 /\* add a line for each product in the user's basket \*/

 \]},

{ event: "flushEvents"}

);

</script>

This path ends here.

<a id="step-887073"></a>

## Configurazione dell’evento per più tipi di pagamento

```javascript
<!-- //Criteo Loader --> 
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR_PARTNER_ID" 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>
```

Il Criteo OneTag deve essere installato sulla pagina di Conferma dell’ordine del tuo sito Web, indipendentemente dal metodo di pagamento selezionato dall’utente, cosicché sia possibile tracciare i prodotti acquistati.  

  
Il tracciamento di quello che l’utente acquista consente a Criteo di ottimizzare la visualizzazione del banner, di modo che i prodotti acquistati dall’utente non vengano più mostrati. Se hai una pagina di Conferma ordine diversa per ciascun metodo di pagamento, accertati che il Criteo OneTag sia implementato su ciascuna di quelle pagine.

**Transazioni al di fuori del tuo dominio**

Se offri un eventuale metodo di pagamento nel punto in cui ha luogo la transazione, ma al di fuori del tuo dominio (ad esempio, PayPal), puoi scoprire che un numero significativo dei tuoi clienti che utilizzano quel metodo di pagamento non vengono reindirizzati al tuo sito. Se non tornano automaticamente alla pagina di Conferma ordine/Ringraziamento, può darsi che tu debba implementare il Criteo OneTag sul pulsante Paga ora, che reindirizza al dominio esterno, in modo che Criteo possa acquisire la transizione.  
  
L’esempio che segue mostra come implementare il Criteo OneTag su un pulsante chiamato "PayPal". Deve essere aggiunta una sola funzione:  
  
**il Criteo OneTag implementato su un pulsante per tracciare vendite esterne**

 <!-- //Criteo Loader -->

<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR\_PARTNER\_ID" 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>

**Come evitare di conteggiare transazioni ripetute causate da molteplici clic**  
  
A volte gli utenti cliccano più volte sul pulsante “Paga ora” che reindirizza al metodo esterno di pagamento. Per evitare l’esecuzione del Criteo OneTag ogni volta che l'utente fa clic, è possibile aggiungere una variabile che impedisca l’esecuzione dell’evento più di una volta.  
  
Vedi l’esempio qui sotto:  
  
**il Criteo OneTag implementato sulla pagina di Conferma dell’ordine con la rilevazione di clic multipli:**

 <!-- //Criteo Loader -->

<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR\_PARTNER\_ID" 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>

**Generazione casuale di un ID Transazione**  
  
Nel caso in cui l’ordine non sia associato a un ID Transazione da passare al Criteo OneTag quando l’utente clicca sul pulsante Paga ora, è possibile utilizzare questa funzione casuale per generarne uno.  
  
**Funzione casuale:**  
  
 Math.floor(Math.random()\*9999999)  
  
Nell’esempio che segue, questa funzione casuale è combinata con il prefisso "Button\_" per creare un ID Transazione che sia individuato più facilmente. Nei casi in cui si usino più opzioni di pagamento, è possibile cambiare la parola "Pulsante" \[Button\] con il metodo selezionato dall’utente. Ad esempio, se hai implementato questo codice su un pulsante che reindirizza a PayPal, puoi utilizzare "PayPal\_" invece di "Button\_" cosicché sarà ancora più facile individuare la transazione.  
  
Nota che il codice che segue è solo un estratto dell’evento di trackTransaction del Criteo OneTag, allo scopo di evidenziare la parte relativa all’ID Transazione.  
  
**Il Criteo OneTag implementato sulla pagina di Conferma dell’ordine:**   
  

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

{ 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 \*/

\]});

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

Next: [How to avoid counting repeated transactions caused by multi-clicks](#step-4335430)

<a id="step-887078"></a>

## Configurazione dell’evento per inserzionisti del travel

```javascript
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR_PARTNER_ID" async="true"></script>

 <script type="text/javascript">

 window.criteo_q = window.criteo_q || [];

 window.criteo_q.push(

 { event: "setAccount", account: YOUR_UNIQUE_ACCOUNT_ID },

 { event: "setSiteType", type: "d" },

 { event: "setEmail", email: "criteotest@test.com" },

 { event: "viewSearch", checkin_date: "2016-08-12", checkout_date: "2016-08-18"},

 { event: "viewBasket", item: [ { id: "FLIGHT_ID1", price: 299.99, quantity: 1 }



 ]});

 </script>
```

Se il tuo sito Web contiene le date per una prenotazione o per il noleggio di qualche prodotto, allora **l’evento viewSearch**può essere un vantaggio per la performance della tua campagna. L’implementazione dell’evento **viewSearch** sul tuo sito consente a Criteo di comprendere meglio l’interesse dell’utente per la prenotazione/il noleggio del viaggio/prodotto desiderato.    

**Evento viewSearch**

  
L’evento **viewSearch** raccoglie sia la data di inizio sia di fine. Queste date aiutano il Criteo AI Engine a raccomandare meglio prodotti al momento corretto, prima dell’acquisto. Fornisce anche le informazioni necessarie per non visualizzare informazioni non rilevanti agli utenti che hanno già superato le date di interesse. 

**  
Modalità di implementazione**

  
Devi semplicemente aggiungere l’evento seguente al Criteo OneTag su ogni pagina in cui sono disponibili le date, e quindi inviare dinamicamente le date nel formato che segue: _gg-MM-aaaa_

 { event: "viewSearch", checkin\_date: "yyyy-MM-dd", checkout\_date: "yyyy-MM-dd"}

  
  
Quindi se l’evento **viewSearch** venisse implementato nell’**evento Carrello**, l’evento stesso avrebbe questo aspetto:  
  

<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR\_PARTNER\_ID" async="true"></script>

 <script type="text/javascript">

 window.criteo\_q = window.criteo\_q || \[\];

 window.criteo\_q.push(

 { event: "setAccount", account: YOUR\_UNIQUE\_ACCOUNT\_ID },

 { event: "setSiteType", type: "d" },

 { event: "setEmail", email: "criteotest@test.com" },

 { event: "viewSearch", checkin\_date: "2016-08-12", checkout\_date: "2016-08-18"},

 { event: "viewBasket", item: \[ { id: "FLIGHT\_ID1", price: 299.99, quantity: 1 }

 \]});

 </script>

This path ends here.

<a id="step-887077"></a>

## Meno/più di 3 ID Prodotto nel Criteo OneTag sulle pagine dei risultati di ricerca

Una pagina con i risultati di una ricerca mostra **più prodotti**, come una **pagina di categorie** o una **pagina con i risultati della ricerca**. L’implementazione di Criteo OneTag su queste pagine consente a Criteo di tracciare l’interesse dell’utente per un certo tipo di prodotto (ad esempio prodotti di una particolare categoria).  

  
Raccomandiamo vivamente di passare i primi **tre** ID Prodotto nel Criteo OneTag sulla pagina dei risultati della ricerca. In alternativa, è possibile passare tre ID Prodotto di prodotti visualizzati sulla pagina.

**Vengono passati più di tre ID Prodotto**

  
Se vengono passati più di tre ID Prodotto, Criteo terrà conto solo dei primi tre ID forniti. Per una performance ottimale, raccomandiamo di passare solo tre ID.

**Vengono passati meno di tre ID Prodotto**

  
Se vengono passati meno di tre ID, Criteo non riesce ad analizzare correttamente le intenzioni dell’utente; questo pregiudicherà la performance della tua campagna. Perciò, è necessario passare sempre tre ID nel Criteo OneTag.

La sola eccezione a questa regola è consentita solo nel caso di risultati di una ricerca che visualizzino meno di tre prodott

This path ends here.

<a id="step-887072"></a>

## Configurazione dell’integrazione di netID

**European netID Foundation**

_"_La European netID Foundation è stata istituita nel marzo 2018 da Mediengruppe RTL Deutschland, ProSiebenSat.1 and United Internet AG.__

__La fondazione persegue **l’obiettivo** di **stabilire l’netID come l’alternativa europea ai fornitori USA di single sign-on**. Con il netID Privacy Center, gli utenti possono organizzare i loro consensi ai servizi di Internet in modo trasparente e conformemente ai regolamenti sulla protezione dei dati.__

__A questo scopo, la fondazione ha sviluppato uno standard aperto che consente agli utenti di tutti i settori di accedere a tutti i servizi Internet dei partner della fondazione, usando dli stessi dati di login."__  
  

**netID**

_"_Grazie al loro account netID centrale, gli utenti possono facilmente e comodamente accedere a un grande numero di servizi Internet._  
_Il login e la password, oltre che il loro consenso all’utilizzo dei loro dati, vengono organizzati in modo trasparente in un Privacy Center, con il vantaggio che il controllo sui dati è completamente ed esclusivamente nelle mani dell’utente._  
_Gli utenti possono modificare il loro consento nel Privacy Center in ogni momento._  
_netID garantisce così standard elevati di sicurezza e la maggior padronanza possibile dei dati_."_

Clicca [qui](https://enid.foundation/en/netid/)  per visitare il sito ufficiale netID.  
 

**Integrazione di netID con Onetag**

Sostituisci dinamicamente i campi circondati da ##. Per maggiori informazioni sui campi, fai riferimento alla tabella di seguito:

<script type="text/javascript">
    window.criteo\_q = window.criteo\_q || \[\];
    window.criteo\_q.push({
        event: 'setIdentity',
        identity: {
            source: "netid.de",
            uids: \[{
                id: "##NetID##"
            }\]
        }
    });
</script>

  

**evento setIdentity**

Questo evento deve attivarsi come qualsiasi altro evento nella coda di eventi.

This path ends here.

<a id="step-1948825"></a>

## SHA256 e MD5 (preferito)

Criteo sta migrando il nostro grafico di identità dall'hashing delle nostre e-mail tramite MD5/SHA256MD5 a SHA256. Per massimizzare le percentuali di corrispondenza tra i tuoi dati e il nostro grafico dell'identità, in particolare durante il periodo di migrazione, condividi il formato precedente (MD5 o SHA256MD5) insieme al nuovo formato SHA256.

Ecco un esempio dell'e-mail con hash SHA256 insieme a un'e-mail MD5 inviata nell'evento **setEmail** :

`{ event: "setEmail", email: "##Hashed Email Address##", hash_method: "md5" }`

`{ event: "setEmail", email: "##Hashed Email Address##", hash_method: "sha256" }`

> **Tip:** Prima dell'hashing, gli indirizzi email di tutti gli utenti devono essere:
>
> -   Rifilato; rimosso di tutti gli spazi prima e dopo l'indirizzo email dell'utente.
>     
> -   Convertito in minuscolo.
>     
> -   Codificato in UTF-8.

L'evento **setEmail** deve essere aggiunto a tutti i tag evento Criteo presenti sul tuo sito web (ad es. Homepage, Prodotto. AddToCart, Carrello, Vendite/Conversione), in modo che l'email venga passata ogni volta che il tuo sito web lo rende disponibile.

Nei passaggi seguenti sono mostrati esempi di come appare questo evento nel tag Homepage di Criteo con la combinazione di MD5 insieme a SHA256, o la combinazione di SHA256MD5 insieme a SHA256

- If "SHA256 insieme a MD5": [Example](#step-1950389)
- If "SHA256 insieme a SHA256MD5": [Example](#step-1950652)

<a id="step-1948824"></a>

## SHA256 hash

Utilizza l'evento **setEmail** se stai passando le email con hash SHA256.

Ecco un esempio di un'e-mail con hash SHA256 inviata nell'evento **setEmail** :

`{ event: "setEmail", email: "46a828eb4c5d239d631a15094c934cada1812d5fc22cd14155ca684832a70938", hash_method: "sha256" }`

> **Tip:** Prima dell'hashing, gli indirizzi email di tutti gli utenti devono essere:
>
> -   Rifilato; rimosso di tutti gli spazi prima e dopo l'indirizzo email dell'utente.
>     
> -   Convertito in minuscolo.
>     
> -   Codificato in UTF-8.

L'evento **setEmail** deve essere aggiunto a tutti i tag evento Criteo presenti sul tuo sito web (ad es. Homepage, Prodotto. AddToCart, Carrello, Vendite/Conversione), in modo che l'email venga trasmessa ogni volta che il tuo sito web lo rende disponibile.

Nel passaggio seguente è mostrato un esempio di come appare questo evento nel tag Homepage di Criteo.

Next: [Example](#step-1950477)

<a id="step-1948817"></a>

## Testo normale

```javascript
<!-- Criteo Homepage Tag -->

<script type="text/javascript">

  window.criteo_q = window.criteo_q || [];

  var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

  window.criteo_q.push(

    { event: "setAccount", account: YOUR_PARTNER_ID},
    { event: "setEmail", email: "##Email Address##"},
    { event: "setSiteType", type: deviceType},
    { event: "setCustomerId", id: "##Customer Id##" },
    { event: "setRetailerVisitorId", id: "##Visitor Id##"},
    { event: "setZipcode", zipcode: "##Zip Code##" },
    { event: "viewHome" }

  );

</script>

<!-- END Criteo Homepage Tag -->
```

Si prega di utilizzare l'evento **setEmail** se si inviano e-mail di testo normale.

Nel caso in cui venga inviato un semplice indirizzo e-mail, Criteo crittograferà automaticamente l'indirizzo e-mail dell'utente prima che venga salvato nel nostro database. Ecco un esempio dell'e-mail di testo normale inviata nell'evento **setEmail** :

`{ event: "setEmail", email: "user@example.com" },`

  
Nel caso in cui non sei in grado di passare un indirizzo e-mail senza hash o hash, passa semplicemente una stringa vuota:

`{ event: "setEmail", email: "" },`

> **Warning:** In alcuni paesi, non è consentito trasmettere indirizzi e-mail in chiaro a terzi a causa della legislazione locale, indipendentemente dal fatto che i dati siano sottoposti a hash prima dell'archiviazione. Sebbene Criteo raccomandi sempre di eseguire l'hashing di qualsiasi informazione dell'utente prima di condividerla con noi, anche la condivisione di e-mail in chiaro è un'opzione. Tuttavia, spetta ai clienti essere a conoscenza delle leggi in vigore e decidere l'approccio migliore per la propria attività e per i mercati in cui operano, nel caso in cui decidano di condividere informazioni non hash.

> **Tip:** Quando si passa testo normale, gli indirizzi email di tutti gli utenti devono essere:
>
> -   Rifilato; rimosso di tutti gli spazi prima e dopo l'indirizzo email dell'utente.
>     
> -   Convertito in minuscolo.
>     
> -   Codificato in UTF-8.

L'evento **setEmail** deve essere aggiunto a tutti i tag evento Criteo presenti sul tuo sito web (ad es. Homepage, Prodotto. AddToCart, Carrello, Vendite/Conversione), in modo che l'email venga passata ogni volta che il tuo sito web lo rende disponibile.

Di seguito è mostrato un esempio di come appare questo evento utilizzando l'hash SHA256 nel tag Homepage di Criteo.

This path ends here.

<a id="step-1950390"></a>

## MD5 o SHA256MD5 (legacy)

Utilizza l'evento **setEmail** se stai passando e-mail con hash MD5 o SHA256MD5.

Ecco un esempio di un'e-mail con hash MD5 inviata nell'evento **setEmail** :

`{ event: "setEmail", email: "f3ada405ce890b6f8204094deb12d8a8", hash_method: "sha256" }`

Ecco un esempio SHA256MD5 inviato nell'evento **setEmail** :

`{ event: "setEmail", email: "0fb0ecec887b92bd4a793669f9a52e8c2af81cdf8a59bc7399c9bc910853fb66", hash_method: "sha256_md5" },`

> **Tip:** Prima dell'hashing, gli indirizzi email di tutti gli utenti devono essere:
>
> -   Rifilato; rimosso di tutti gli spazi prima e dopo l'indirizzo email dell'utente.
>     
> -   Convertito in minuscolo.
>     
> -   Codificato in UTF-8.

L'evento **setEmail** deve essere aggiunto a tutti i tag evento Criteo presenti sul tuo sito web (ad es. Homepage, Prodotto. AddToCart, Carrello, Vendite/Conversione), in modo che l'email venga trasmessa ogni volta che il tuo sito web lo rende disponibile.

Il passaggio seguente mostra un esempio di come appare questo evento nel tag Homepage di Criteo.

- If "MD5 hash": [Example](#step-1958150)
- If "SHA256MD5 Hashing": [Example](#step-1958151)

<a id="step-1948827"></a>

## Funzioni di hashing

Se si esegue l'hashing dell'indirizzo e-mail dell'utente prima che venga passato a Criteo, è possibile utilizzare una delle seguenti funzioni per garantire una crittografia adeguata.

- If "SHA256 Funzione di hash che utilizza JavaScript": [SHA256 Hashing Function using JavaScript](#step-1957333)
- If "SHA256 Funzione di hashing usando C\#": [SHA256 Hashing function using C\#](#step-1951709)
- If "SHA256 Funzione di hashing tramite Java": [SHA256 Hashing function using Java](#step-1951710)
- If "SHA256 Funzione di hashing tramite Perl": [SHA256 Funzione di hashing tramite Perl](#step-1951708)
- If "SHA256 Funzione di hashing tramite PHP": [SHA256 Funzione di hashing tramite PHP](#step-1951742)
- If "MD5 Funzione di hashing tramite PHP": [MD5 Funzione di hashing tramite PHP](#step-1951849)
- If "Funzione di hashing MD5 utilizzando C\#": [Funzione di hashing MD5 utilizzando C\#](#step-1951850)
- If "Funzione Hashing MD5 tramite Java": [Funzione Hashing MD5 tramite Java](#step-1951851)
- If "MD5 hashing function using JS": [MD5 hashing function using JS](#step-3858724)

<a id="step-1948826"></a>

## FAQ

**Devo aggiornare l'informativa sulla privacy del mio sito web?**

È necessario assicurarsi che l'Informativa sulla privacy del sito Web informi chiaramente i visitatori del sito Web che gli indirizzi e-mail possono essere raccolti e condivisi con terze parti con cui si collabora per ottimizzare le prestazioni della campagna e che queste informazioni vengono sottoposte a hash utilizzando la tecnologia di hash SHA256 più recente e sicura. Pertanto, nessun dato PII viene condiviso con terze parti.

Inoltre, dovresti informare i tuoi visitatori che rispetti la loro privacy e, se preferiscono non condividere tali informazioni, possono farlo selezionando le loro opzioni preferite nel banner di conformità ai cookie dell'utente del tuo sito web (CMP).

Per ulteriori informazioni, fare riferimento [all'Informativa sulla privacy di Criteo](https://help.criteo.com/kb/guide/en/the-criteo-privacy-promise-pDIW4yiawH/Steps/775742) e includere il collegamento fornito nella sezione Informativa sulla privacy del proprio sito Web.

> **Tip:** Se il tuo team legale ha dei dubbi relativi alla privacy, può contattare il tuo contatto commerciale Criteo che lo metterà in contatto con il nostro team legale, se necessario.

**Sto già trasmettendo l'hash dell'e-mail in formato MD5 nei miei tag, cosa devo fare?**

Dovresti continuare a passare in questo modo e assicurarti che il parametro "hash-method" sia impostato su "md5". Nota che Criteo prende questa stringa e la codifica tramite SHA256 in aggiunta prima di memorizzarla.

Quindi dovresti aggiungere un ulteriore evento ' **setEmail** ' , in tutti i tuoi tag Criteo, per passare anche SHA256. Quando viene aggiunto questo evento aggiuntivo, assicurati che il parametro "hashed\_method" sia impostato su "sha256", ad esempio:

`{ event: "setEmail", email: "##Hashed Email Address##", hash_method: "md5" }`

`{ event: "setEmail", email: "##Hashed Email Address##", hash_method: "sha256" }`

**Sto già trasmettendo l'hash dell'e-mail in formato SHA256MD5 nei miei tag, cosa devo fare?**

Dovresti continuare a passare in questo modo e assicurarti che il parametro "hash-method" sia impostato su "md5". Nota che Criteo prende questa stringa e SHA256 la codifica in hash in aggiunta prima di memorizzarla.

Quindi dovresti aggiungere un ulteriore evento ' **setEmail** ' , in tutti i tuoi tag Criteo, per passare anche SHA256. Quando viene aggiunto questo evento aggiuntivo, assicurati che il parametro "hashed\_method" sia impostato su "sha256", ad esempio:

`{ event: "setEmail", email: "##Hashed Email Address##", hash_method: "sha256_md5" }`

`{ event: "setEmail", email: "##Hashed Email Address##", hash_method: "sha256" }`

**Ho solo la possibilità di passare l'hash dell'e-mail in SHA256, cosa devo fare?**

Non c'è bisogno di modifiche. Assicurati che il parametro "hash\_method" sia impostato su "sha256", ad esempio:

`{ event: "setEmail", email: "##Hashed Email Address##", hash_method: "sha256" }`

This path ends here.

<a id="step-4106563"></a>

## SHA256

```javascript
<!-- Criteo Homepage Tag -->
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
  window.criteo_q.push(
    { event: "setAccount", account: YOUR_PARTNER_ID},
    { event: "setEmail", email: "##Email Address##", hash_method: "sha256" },
    { event: "setSha256HashedPhoneNumber", phone_number: "fda66831d0cb0eb4bffb21bc795308d69921c211c57be0ae15702071e3b9e989" },
    { event: "setSiteType", type: deviceType},
    { event: "setCustomerId", id: "##Customer Id##" },
    { event: "setRetailerVisitorId", id: "##Visitor Id##"},
    { event: "setZipcode", zipcode: "##Zip Code##" },
    { event: "viewHome" }
  );
</script>
```

As phone numbers are a sensitive PII, Criteo accepts hashed phone numbers from partners and encourages it. 

Expected underlying phone numbers format is a trimmed [E.164](https://en.wikipedia.org/wiki/E.164) format including the country code, without the leading "+" sign (so only 15 digits, at most): sha256(internationalPhoneNumber.replaceAll(/\[^0-9\]/g, "")).

**Examples:**

-   1 (234) 567-8910 → sha256(12345678910) → 63640264849a87c90356129d99ea165e37aa5fabc1fea46906df1a7ca50db492
    
-   81-12-3456-7891 → sha256(811234567891) → d9825fb05347d3c910fc5202c0c20d07a87b791cc643c6f2d70402394a849540
    
-   02 1234 5678 → sha256(0212345678) → 826f54894e28f3f1795f3c5e3335cf98709c5d5b38b3f9c6d72467d491f032df
    
-   +33 1 40 40 22 90 → sha256(33140402290) → fda66831d0cb0eb4bffb21bc795308d69921c211c57be0ae15702071e3b9e988
    

Please use the **setSha256HashedPhoneNumber** event if you are passing SHA256 hashed phone numbers. Here is an example of the SHA256 hashed phone number sent in the setSha256HashedPhoneNumber event:

`{ event: "setSha256HashedPhoneNumber", phone_number: "fda66831d0cb0eb4bffb21bc795308d69921c211c57be0ae15702071e3b9e989" }`

The **setSha256HashedPhoneNumber** event should be added to **all of the Criteo event tags** that are on your website (e.g. Homepage, Product. AddToCart, Basket, Sales/Conversion), so that the phone number is passed whenever your website has it available.

Examples of how this event looks in Criteo's Homepage tag is visible on the left side.

This path ends here.

<a id="step-4106562"></a>

## Plain Text

```javascript
<!-- Criteo Homepage Tag -->
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
  window.criteo_q.push(
    { event: "setAccount", account: YOUR_PARTNER_ID},
    { event: "setEmail", email: "##Email Address##", hash_method: "sha256" },
    { event: 'setPhoneNumber', phone_number: '+33 (0) 1 40 40 22 90' },
    { event: "setSiteType", type: deviceType},
    { event: "setCustomerId", id: "##Customer Id##" },
    { event: "setRetailerVisitorId", id: "##Visitor Id##"},
    { event: "setZipcode", zipcode: "##Zip Code##" },
    { event: "viewHome" }
  );
</script>
```

**In the event that a plain phone number is sent, Criteo will encrypt the user’s phone number automatically before it is saved in our database.**

On Criteo's side we will validate and normalize the numbers collected. Any international formats are accepted (including the leading "+" sign). Normalization removes all non numeric characters.

**Validation checks:**

-   Number starts with a + sign
    
-   length is at most 15 digits
    
-   there is no leading 0: many countries use 0 as national dial number
    

**Examples:**

-   +1 (234) 567-8910
    
-   +81-12-3456-7891
    
-   +33 1 40 40 22 90
    
-   02 1234 5678 is **rejected** because of a leading 0 indicating that it is a national phone number
    

As with other ids, phone numbers will be hashed before being stored. Criteo's backend maps the clear phone numbers to SHA256 HPN so the two accepted formats are uniform. Criteo doesn't have access to any phone number shared with us.  

> **Tip:** Although clear-text phone numbers are accepted, **it's highly recommended to use the SHA-256 hash** when sharing any type of user information.

> **Tip:** **Note:** In some countries, it is not allowed to pass clear-text phone numbers to third parties due to local legislation, regardless of whether the data is hashed before storage. While Criteo recommends always hashing any user information before sharing it with us, sharing clear-text phone numbers is also an option. However, you must be aware of the laws in effect and decide the best approach for your business and the market(s) you operate, in case you decide to share non-hashed information.

Please use the **setPhoneNumber** event if you are passing plain text phone numbers. Here is an example of a plain phone number sent in the setPhoneNumber event:

`{ event: 'setPhoneNumber', phone_number: '+33 (0) 1 40 40 22 90' }`

The **setPhoneNumber** event should be added to **all of the Criteo event tags** that are on your website (e.g. Homepage, Product. AddToCart, Basket, Sales/Conversion), so that the phone number is passed whenever your website has it available.  
  
Examples of how this event looks in Criteo's Homepage tag is shown on the left.

This path ends here.

<a id="step-4335430"></a>

## How to avoid counting repeated transactions caused by multi-clicks

```javascript
<!-- //Criteo Loader --> 
 <script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=YOUR_PARTNER_ID" 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>
```

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.  
  
**The Criteo OneTag implemented on a Sales Confirmation page with multi-click detection is on the left.**

Next: [Generating a random Transaction ID](#step-4335431)

<a id="step-1950389"></a>

## Example

```javascript
<!-- Criteo Homepage Tag -->

<script type="text/javascript">

  window.criteo_q = window.criteo_q || [];

  var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

  window.criteo_q.push(

    { event: "setAccount", account: YOUR_PARTNER_ID},
    { event: "setEmail", email: "##Email Address##", hash_method: "sha256" },
    { event: "setEmail", email: "##Email Address##", hash_method: "md5" },
    { event: "setSiteType", type: deviceType},
    { event: "setCustomerId", id: "##Customer Id##" },
    { event: "setRetailerVisitorId", id: "##Visitor Id##"},
    { event: "setZipcode", zipcode: "##Zip Code##" },
    { event: "viewHome" }

  );

</script>

<!-- END Criteo Homepage Tag -->
```

This path ends here.

<a id="step-1950652"></a>

## Example

```javascript
<!-- Criteo Homepage Tag -->

<script type="text/javascript">

  window.criteo_q = window.criteo_q || [];

  var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

  window.criteo_q.push(

    { event: "setAccount", account: YOUR_PARTNER_ID},
    { event: "setEmail", email: "##Email Address##", hash_method: "sha256" },
    { event: "setEmail", email: "##Email Address##", hash_method: "sha256_md5" },
    { event: "setSiteType", type: deviceType},
    { event: "setCustomerId", id: "##Customer Id##" },
    { event: "setRetailerVisitorId", id: "##Visitor Id##"},
    { event: "setZipcode", zipcode: "##Zip Code##" },
    { event: "viewHome" }

  );

</script>

<!-- END Criteo Homepage Tag -->
```

This path ends here.

<a id="step-1950477"></a>

## Example

```javascript
<!-- Criteo Homepage Tag -->

<script type="text/javascript">

  window.criteo_q = window.criteo_q || [];

  var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

  window.criteo_q.push(

    { event: "setAccount", account: YOUR_PARTNER_ID},
    { event: "setEmail", email: "##Email Address##", hash_method: "sha256" },
    { event: "setSiteType", type: deviceType},
    { event: "setCustomerId", id: "##Customer Id##" },
    { event: "setRetailerVisitorId", id: "##Visitor Id##"},
    { event: "setZipcode", zipcode: "##Zip Code##" },
    { event: "viewHome" }

  );

</script>

<!-- END Criteo Homepage Tag -->
```

This path ends here.

<a id="step-1958150"></a>

## Example

```javascript
<!-- Criteo Homepage Tag -->

<script type="text/javascript">

  window.criteo_q = window.criteo_q || [];

  var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

  window.criteo_q.push(

    { event: "setAccount", account: YOUR_PARTNER_ID},
    { event: "setEmail", email: "##Email Address##", hash_method: "md5" },
    { event: "setSiteType", type: deviceType},
    { event: "setCustomerId", id: "##Customer Id##" },
    { event: "setRetailerVisitorId", id: "##Visitor Id##"},
    { event: "setZipcode", zipcode: "##Zip Code##" },
    { event: "viewHome" }

  );

</script>

<!-- END Criteo Homepage Tag -->
```

This path ends here.

<a id="step-1958151"></a>

## Example

```javascript
<!-- Criteo Homepage Tag -->

<script type="text/javascript">

  window.criteo_q = window.criteo_q || [];

  var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";

  window.criteo_q.push(

    { event: "setAccount", account: YOUR_PARTNER_ID},
    { event: "setEmail", email: "##Email Address##", hash_method: "sha256_md5" },
    { event: "setSiteType", type: deviceType},
    { event: "setCustomerId", id: "##Customer Id##" },
    { event: "setRetailerVisitorId", id: "##Visitor Id##"},
    { event: "setZipcode", zipcode: "##Zip Code##" },
    { event: "viewHome" }

  );

</script>

<!-- END Criteo Homepage Tag -->
```

This path ends here.

<a id="step-1957333"></a>

## SHA256 Hashing Function using JavaScript

```javascript
async function sha256(message) {
  // encode as UTF-8
  const msgBuffer = new TextEncoder('utf-8').encode(message);

  // hash the message
  const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);

  // convert ArrayBuffer to Array
  const hashArray = Array.from(new Uint8Array(hashBuffer));

  // convert bytes to hex string
  const hashHex = hashArray.map(b => ('00' + b.toString(16)).slice(-2)).join('');
  return hashHex;
}

function format(email) {
	return email.toLowerCase().trim();
}

var email = "   uSèr@example.Com   ";
//CHANGE BASED ON WHAT YO USUALLY PUT AS EXAMPLE
var hemPromise = sha256(format(email));
hemPromise.then(hem => console.log(hem));
```

This path ends here.

<a id="step-1951709"></a>

## SHA256 Hashing function using C\#

```text/x-csharp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
namespace Sample_EmailHashing_code {
  public class CriteoHashedEmailFormatter {
    private static SHA256 _sha256;
    private static SHA256 Sha256 {
      get {
        return _sha256 ?? (_sha256 = SHA256.Create());
      }
    }
    private static string Sha256Encode(string sourceString) {
      byte[] inputBytes = Encoding.UTF8.GetBytes(sourceString);
      byte[] hash = Sha256.ComputeHash(inputBytes);
      var sb = new StringBuilder(32);
      foreach(byte b in hash) sb.Append(b.ToString("x2"));
      return sb.ToString();
    }
    public static string HashEmail(string sourceEmail) {
      String processedEmail;
      processedEmail = sourceEmail.ToLowerInvariant(); //conversion to lower case
      processedEmail = processedEmail.Trim(); //trimming leading and trailing spaces
      processedEmail = Sha256Encode(processedEmail); //conversion to UTF-8 and hashing with SHA256
      return processedEmail;
    }
  }
  class SampleEmailHashing {
    static void Main(string[] args) {
      String sourceEmail = "   uSèr@example.Com   ";
      String processedEmail = CriteoHashedEmailFormatter.HashEmail(sourceEmail);
      Console.WriteLine(processedEmail);
      Console.ReadKey();
    }
  }
}
```

This path ends here.

<a id="step-1951710"></a>

## SHA256 Hashing function using Java

```text/x-java
import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class SampleEmailHashing {
  public static void main(String[] args) {
    String sourceEmail = new String(" uSèr@example.Com ");
    String processedEmail = FormatMail(sourceEmail);
    System.out.println(processedEmail);
  } //Method to format the source Email, converting to lower case and removing spaces               
  private static String FormatMail(String mail) {
    String newMail = new String(mail);
    // conversion to lower case characters          
    newMail = newMail.toLowerCase();
    //remove empty spaces          
    newMail = newMail.trim();
    newMail = sha256Java(newMail);
    return newMail;
  } //Method to encrypt email address using MD5      
  public static String sha256Java(String message) {
    String digest = null;
    try { //conversion to UTF-8 and hashing with SHA256
      MessageDigest md = MessageDigest.getInstance("SHA256");
      byte[] hash = md.digest(message.getBytes("UTF-8"));
      StringBuilder sb = new StringBuilder(2 * hash.length);
      for (byte b: hash) {
        sb.append(String.format("%02x", b & 0xff));
      }
      digest = sb.toString();
    } catch (UnsupportedEncodingException ex) {
      ex.printStackTrace();
    } catch (NoSuchAlgorithmException ex) {
      ex.printStackTrace();
    }
    return digest;
  }
}
```

This path ends here.

<a id="step-1951708"></a>

## SHA256 Funzione di hashing tramite Perl

```perl
#!/usr/bin/perl  

 use strict;  

 use warnings;  

 use Digest::SHA256 qw(sha256 sha256_hex);  

 use Encode;  

 my $original_email  = qw/ uSèr@example.Com /;  

 my $processed_email = lc($original_email);     

    $processed_email =~ s/^\s+//;     

    $processed_email =~ s/\s+$//;     

    $processed_email = encode_utf8($processed_email);     

    $processed_email = sha256_hex($processed_email);  

 print "Original email:\t$original_email\n";  

 print "Hashed email:\t$processed_email \n"; 
```

This path ends here.

<a id="step-1951742"></a>

## SHA256 Funzione di hashing tramite PHP

```php
$source_address = "uSèr@example.Com "; 
$processed_address = strtolower($source_address); //convert address to lower case 
$processed_address = trim($processed_address); //trimming leading and trailing spaces
$processed_address = mb_convert_encoding($processed_address, "UTF-8", "ISO-8859-1"); //conversion from ISO-8859-1 to UTF-8 (replace "ISO-8859-1" with the source encoding of your string) 
$processed_address = hash('sha256', $processed_address, false); //hash address with SHA256 algorithm 
echo "Source e-mail: ".$source_address." | Hashed e-mail: ".$processed_address;
```

This path ends here.

<a id="step-1951849"></a>

## MD5 Funzione di hashing tramite PHP

```php
$source_address = "uSèr@example.Com "; 
$processed_address = strtolower($source_address); //convert address to lower case 
$processed_address = trim($processed_address); //trimming leading and trailing spaces 
$processed_address = mb_convert_encoding($processed_address, "UTF-8", "ISO-8859-1"); //conversion from ISO-8859-1 to UTF-8 (replace "ISO-8859-1" with the source encoding of your string) 
$processed_address = hash('md5', $processed_address, false); //hash address with SHA256 algorithm 
echo "Source e-mail: ".$source_address." | Hashed e-mail: ".$processed_address;
```

This path ends here.

<a id="step-1951850"></a>

## Funzione di hashing MD5 utilizzando C\#

```text/x-csharp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
namespace Sample_EmailHashing_code {
  public class CriteoHashedEmailFormatter {
    private static MD5 _md5;
    private static MD5 Md5 {
      get {
        return _md5 ?? (_md5 = MD5.Create());
      }
    }
    private static string Md5Encode(string sourceString) {
      byte[] inputBytes = Encoding.UTF8.GetBytes(sourceString);
      byte[] hash = Md5.ComputeHash(inputBytes);
      var sb = new StringBuilder(32);
      foreach(byte b in hash) sb.Append(b.ToString("x2"));
      return sb.ToString();
    }
    public static string HashEmail(string sourceEmail) {
        String processedEmail;
        processedEmail = sourceEmail.ToLowerInvariant(); //conversion to lower case              
        processedEmail = processedEmail.Trim(); //trimming leading and trailing spaces              
        //conversion to UTF-8 and hashing with SHA256              
        processedEmail = Md5Encode(processedEmail);              
        return processedEmail;          
    }      
  }      
  class SampleEmailHashing      {          
    static void Main(string[] args)          {              
      String sourceEmail = "   uSèr@example.Com   ";              
      String processedEmail = CriteoHashedEmailFormatter.HashEmail(sourceEmail);              
      Console.WriteLine(processedEmail);              Console.ReadKey();          
    }      
  }  
}
```

This path ends here.

<a id="step-1951851"></a>

## Funzione Hashing MD5 tramite Java

```clike
import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class SampleEmailHashing {
  public static void main(String[] args) {
    String sourceEmail = new String(" uSèr@example.Com ");
    String processedEmail = FormatMail(sourceEmail);
    System.out.println(processedEmail);
  } //Method to format the source Email, converting to lower case and removing spaces               
  private static String FormatMail(String mail) {
    String newMail = new String(mail);
    // conversion to lower case characters          
    newMail = newMail.toLowerCase();
    //remove empty spaces          
    newMail = newMail.trim();
    newMail = md5Java(newMail);
    return newMail;
  } //Method to encrypt email address using MD5      
  public static String md5Java(String message) {
    String digest = null;
    try { //conversion to UTF-8 and hashing with MD5
      MessageDigest md = MessageDigest.getInstance("MD5");
      byte[] hash = md.digest(message.getBytes("UTF-8"));
      StringBuilder sb = new StringBuilder(2 * hash.length);
      for (byte b: hash) {
        sb.append(String.format("%02x", b & 0xff));
      }
      digest = sb.toString();
    } catch (UnsupportedEncodingException ex) {
      ex.printStackTrace();
    } catch (NoSuchAlgorithmException ex) {
      ex.printStackTrace();
    }
    return digest;
  }
}
```

This path ends here.

<a id="step-3858724"></a>

## MD5 hashing function using JS

```javascript
// md5 function should be provided by the client (by installing a 3rd party one)

function format(email) {
	return email.toLowerCase().trim();
}

var email = "   uSèr@example.Com   ";
var hemPromise = md5(format(email));
hemPromise.then(hem => console.log(hem));
```

> **Tip:** **Important**
>
> Make sure to install this external library [https://www.md5.cz/javascript-md5](https://www.md5.cz/javascript-md5b) before you implement the code in the page.

This path ends here.

<a id="step-4335431"></a>

## Generating a random Transaction ID

```javascript
<!--............ --> 
{ 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 */ 
    ]}); 
<!--............ -->  
```

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 that redirects to PayPal, you can use "PayPal\_" instead of "Button\_" so it is even easier to identify the transaction.  
  
Note that the code on the left 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 on the left.**

This path ends here.
