HomeGuidesChangelog
Log In
Guides

OneTag for Retail Media Onsite

📘

Already a Criteo customer?

If you have already implemented OneTag for Criteo's Performance Marketing solution, you simply need to make adjustments to your tag so that it incorporates any missing parameters outlined below!

The Criteo OneTag method (JavaScript integration) uses a tag that is loaded/fired on each page of a user's shopping journey. The tag is used to log user events, build audiences, and serve ads on appropriate pages.

This approach is similar to Direct Ad Server integration, but the tag:

  1. Sends ad requests to Criteo.
  2. Injects the ads onto the site, instead of the retailer handling this process via API calls.

Process overview

  1. The user visits a page.
  2. Criteo's OneTag is triggered.
  3. The tag sends user interaction data (e.g., keywords or categories) to Criteo.
  4. If the page is set up to receive ads, Criteo runs an auction and returns:
    1. The winning IDs for sponsored products, and/or the creative images and rendering attributes for display ads.
    2. Tracking beacons for loads, views, and clicks.
  5. The Criteo JavaScript library injects the ads onto the page.
  6. Interaction data (loads, views, and clicks) are sent back to Criteo for tracking.

Where to implement OneTag

Required pages

  • Any page with ad placements: Ads will not render or be tracked without the tag.
  • Search pages: Typically the highest trafficked, highest revenue page, and is required to build Criteo's keyword model.
  • Product detail pages: Updates product prices and availability in real-time, and is required to build Criteo's keyword model.
  • Order confirmation pages: Measures Return-on-Ad-Spend (ROAS) for brands and demonstrates the effectiveness of the ad program.

Recommended pages

  • Browse and merchandising pages: Typically the second-highest trafficked/revenue-producing page type
  • Homepage: Leveraged for total audience sizing and forecasting
  • Basket pages: Improves algorithm accuracy by allowing Criteo to learn which products are typically purchased together.
  • Add-to-cart events: Helps build Criteo's keyword model and enhances audience creation/targeting.

Dynamic loader

Add the following script to all pages in order to load your dedicated JavaScript library, ensuring you populate the placeholder with your dedicated Criteo Partner ID. Your dedicated library will be responsible for triggering the ad requests to Criteo and rendering the ads to your site's specific look at feel. Without the loader, tags cannot be triggered

<!-- Criteo Loader File -->
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=##PartnerID##" async="true"></script>
<!-- END Criteo Loader File -->

Universal events

These events should be set on all page types

EventKeyExample valueDescriptionRequired?
setAccountaccount12345Criteo Account/Partner ID, provided by your technical contact.Yes
setRetailerVisitorIdid0193553C0A39937F23FCA unique, unauthenticated user ID valid for at least 30 days. Used to track visitor behavior across sessions. Typically retrieved via a first-party cookie.Yes
setCustomerIdid1SDFJI435FH12HFK2A consistent, internal ID for logged-in users, linked to accounts, purchase history, or membership programs.Highly recommended to improve x-device ROAS and enable in-store sales attribution.
setEmailemaild9c37700(...)18be88User’s email address in SHA256 hash format.Highly recommended to improve offsite retargeting.
setSiteTypetypedDevice type: d for desktop, m for mobile, t for tablet.No

Page specific events, parameters, and sample tags

Homepage

When adding tags to the homepage, specify the universal events as well as the viewHome event and its associated parameters:

EventParameterExample valueDescriptionRequired?
viewHomepage_idEMEA:
viewHomeDesktop
viewHomeMobile

AMER:
viewHome_desktop
viewHome_mobile
Use standard page IDs unless otherwise specified.Yes
viewHomestore_id1537The ID of the specific store that the user is browsing.Only pass this value if your product feed includes regiondata .
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  window.criteo_q.push(
    { event: "setAccount", account: "12345" }, // Your partner ID
    { event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // Guest user ID
    { event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // Logged-in user ID
    { 
      event: "setEmail", 
      email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // Hashed email (SHA-256)
    },
    { event: "setSiteType", type: "d" }, // Device type
    { 
      event: "viewHome", 
      page_id: "viewHomeDesktop", // Platform-specific page ID
      store_id: "1537" // Store-specific ID
    }
  );
</script>

Browse page

For all category or taxonomy browse pages displaying a grid/list of products, or if you display a
tailored collection of products, specify in the tag the universal events as well as the viewCategory event and its associated parameters:

EventParameterExample valueDescriptionRequired?
viewCategorypage_idEMEA:
viewCategoryDesktop
viewCategoryMobile

AMER:
viewCategory_desktop
viewCategory_mobile
Use standard page IDs unless otherwise specified.Yes
viewCategoryitem["123","321","456"]IDs of the organic products shown, matching the IDs passed in the product feed. Used for deduplication.Required for ad de-duplication.

Recommended for offsite targeting and audience building.
viewCategorypage_number2The page number that the user is browsing. Make sure to re-fire the tag as the user navigates through each page so that fresh ads can be requested and rendered.Recommended to vary ad selection as the user navigates the grid.
viewCategorycategory"Men>Shoes>Slippers" or "21>45732>23568553"Category path, matching the product_type_key passed in the feed.Yes
viewCategoryfilters{name: "brand", operator: "eq", value: "Nike"}Restricts ad response to specific attributes. Ensure these filter names and values match exactly what is passed in the feed. A list of accepted filter operators can be found here .Recommended to improve relevant advertising on filtered pages.
viewCategorystore_id1537The ID of the specific store that the user is browsing.Only pass this value if your product feed includes regiondata
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  window.criteo_q.push(
    { event: "setAccount", account: "12345" }, // Your partner ID
    { event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
    { event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
    { event: "setEmail", email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" }, // User's SHA-256 hashed email
    { event: "setSiteType", type: "d" }, // User's device type
    { 
      event: "viewCategory",
      item: ["123", "321", "456"], // All organic products in order
      page_id: "viewCategory_desktop", // Platform-specific page ID
      page_number: "2", // Page number of the grid
      category: "21>45732>23568553", // Category breadcrumb of the browse page
      filters: [
        {
          name: "brand",
          operator: "eq",
          value: "Nike" // Filters set by the user
        }
        // Add a line for each filter set on the page
      ],
      store_id: "1537" // User's store ID
    }
  );
</script>

Merchandising page

For all top-level category or taxonomy browse pages that do not display a listing of products,
specify in the tag the universal events as well as the following additional parameters:

EventParameterExample valueDescriptionRequired?
viewCategorypage_idEMEA:
viewMerchandisingDesktop
viewMerchandisingMobile

AMER:
viewMerchandising_desktop
viewMerchandising_mobile
Use standard page IDs unless otherwise specified.Yes
viewCategoryitem["None"]Enter this hardcoded value when there is no product grid on listing pagesNo
viewCategorycategory"Men" or "21"Category path, matching the product_type_key passed in the feed.Yes
viewCategorystore_id1537The ID of the specific store that the user is browsing.Only pass this value if your product feed includes regiondata .
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  window.criteo_q.push(
    { event: "setAccount", account: "12345" }, // Your partner ID
    { event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
    { event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
    { 
      event: "setEmail", 
      email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
    },
    { event: "setSiteType", type: "d" }, // User's device type
    { 
      event: "viewCategory",
      item: ["None"],
      page_id: "viewMerchandising_desktop", // Platform-specific page ID
      category: "21", // Category breadcrumb of the browse page
      store_id: "1537" // User's store ID
    }
  );
</script>

Search page

For all search result pages displaying a grid/listing of products, specify in the tag the universal events as well as the following additional parameters.

EventParameterExample valueDescriptionRequired?
viewSearchResultpage_idEMEA:
viewSearchResultDesktop
viewSearchResultMobile

AMER:
viewSearchResult_desktop
viewSearchResult_mobile
Use standard page IDs unless otherwise specified.Yes
viewSearchResultitem["123", "321", "456"]IDs of the organic products shown, matching the IDs passed in the product feed. Used for deduplication.Required for ad de-duplication.

Recommended for offsite targeting and audience building.
viewSearchResultpage_number2The page number that the user is browsing. Make sure to re-fire the tag as the user navigates through each page so that fresh ads can be requested and rendered.Recommended to vary ad selection as the user navigates the grid.
viewSearchResultkeywordsrunning shoesUser-entered search term. If you perform a spell check internally before rendering results, please pass in the corrected keyword.Yes
viewSearchResultfilters{name: "brand", operator: "eq", value: "Nike"}Restricts ad response to specific attributes. Ensure these filter names and values match exactly what is passed in the feed . A list of accepted filter operators can be found here .Recommended to improve relevant advertising on filtered pages.
viewSearchResultstore_id1537The ID of the specific store that the user is browsing.Only pass this value if your product feed includes regiondata.
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  window.criteo_q.push(
    { event: "setAccount", account: "12345" }, // Your partner ID
    { event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
    { event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
    { 
      event: "setEmail", 
      email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
    },
    { event: "setSiteType", type: "d" }, // User's device type
    { 
      event: "viewSearchResult",
      item: ["123", "321", "456"], // All organic products in order
      page_id: "viewSearchResultMobile", // Platform-specific page ID
      page_number: "2", // Page number of the grid
      keywords: "running shoes", // User's entered keyword
      filters: [
        {
          name: "brand",
          operator: "eq",
          value: "Nike" // Filters set by the user
        }
        // Add a line for each filter set on the page
      ],
      store_id: "1537" // User's store ID
    }
  );
</script>

Null search result page

For all search result pages not displaying any products, specify in the tag the universal events as well as the following additional parameters.

KeyParameterExample valueDescriptionRequired?
viewSearchResultpage_idEMEA:
viewNullSearchResultDesktop
viewNullSearchResultMobile

AMER:
viewNullSearchResult_desktop
viewNullSearchResult_mobile
Use standard page IDs unless otherwise specified.Yes
viewSearchResultitem["None"]Enter this hardcoded value when there is no product grid on listing pagesNo
viewSearchResultkeywordsjsdadfnuiwfUser-entered search term. If you perform a spell check internally before rendering results, please pass in the corrected keyword.Yes
viewSearchResultstore_id1537The ID of the specific store that the user is browsing.Only pass this value if your product feed includes regiondata.
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  window.criteo_q.push(
    { event: "setAccount", account: "12345" }, // Your partner ID
    { event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
    { event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
    { 
      event: "setEmail", 
      email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
    },
    { event: "setSiteType", type: "d" }, // User's device type
    { 
      event: "viewSearchResult",
      item: ["None"],
      page_id: "viewNullSearchResultMobile", // Platform-specific page ID
      keywords: "jsdadfnuiwf", // User's entered keyword
      store_id: "1537" // User's store ID
    }
  );
</script>

Product detail page

EventParameterExample valueDescriptionRequired?
viewItempage_idEMEA:
viewItemDesktop
viewItemMobile

AMER:
viewItem_desktop
viewItem_mobile
Use standard page IDs unless otherwise specified.Yes
viewItemitem1573236SKU ID of the currently visited product. Must match the value passed in the id column of the product feed.Yes
viewItemparent_itemP64388324The parent ID of the currently visited product. Must match the value passed in the item_group_id column of the product feed.No
viewItemprice5.99The current unit price of the visited product, leveraged for real-time updates in Criteo's system.Yes
viewItemavailability1Product availability: 1 for in stock, 0 for out of stock.Yes
viewItemstore_id1537The ID of the specific store that the user is browsing.Only pass this value if your product feed includes regiondata.
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  window.criteo_q.push(
    { event: "setAccount", account: "12345" }, // Your partner ID
    { event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
    { event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
    { 
      event: "setEmail", 
      email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
    },
    { event: "setSiteType", type: "d" }, // User's device type
    { 
      event: "viewItem",
      page_id: "viewItem_mobile", // Platform-specific page ID
      item: "1573236", // Viewed item's SKU ID
      parent_item: "P64388324", // Viewed item's parent ID
      price: "5.99", // Viewed item's current unitary price
      availability: "1", // Viewed item's availability status
      store_id: "1537" // User's store ID
    }
  );
</script>

Add-to-cart event

EventParameterExample valueDescriptionRequired?
addToCartpage_idUse the same page_id of where the event took placeThis is not a page view, but rather an event that takes place after the page has been loaded. For that reason, the page_id remains unchanged from the initial page load.Yes
addToCartitem[{id:"123", price:3.99, quantity:3}]A product array for the SKU added to the basket with ID, unitprice, and quantity. IDs must match the id column of the product feed.Yes
addToCartstore_id1537The ID of the specific store that the user is browsing.Only pass this value if your product feed includes regiondata.
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  window.criteo_q.push(
    { event: "setAccount", account: "12345" }, // Your partner ID
    { event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
    { event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
    { 
      event: "setEmail", 
      email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
    },
    { event: "setSiteType", type: "d" }, // User's device type
    { 
      event: "addToCart",
      page_id: "viewSearchResult_desktop", // Platform-specific page ID
      item: [
        {
          id: "123", // Added product's ID
          price: "3.99", // Added product's unitary price
          quantity: "3" // Quantity of product added to cart
        }
      ],
      store_id: "1537" // User's store ID
    }
  );
</script>

Basket page

ParameterEventExample valueDescriptionRequired?
page_idviewBasketEMEA:
viewBasketDesktop
viewBasketMobile

AMER:
viewBasket_desktop
viewBasket_mobile
Use standard page IDs unless otherwise specified.Yes
itemviewBasketIf empty: ["None"]

If populated: [{id:"123", price:3.99, quantity:3}]
An array of products in the basket with ID, unitprice, and quantity. IDs must match the id column of the product feed.Yes
store_idviewBasket1537The ID of the specific store that the user is browsing.Only pass this value if your product feed includes regiondata.
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  window.criteo_q.push(
    { event: "setAccount", account: "12345" }, // Your partner ID
    { event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
    { event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
    { 
      event: "setEmail", 
      email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
    },
    { event: "setSiteType", type: "d" }, // User's device type
    { 
      event: "viewBasket",
      page_id: "viewBasketMobile", // Platform-specific page ID
      item: [
        {
          id: "123", // Product's ID
          price: "3.99", // Product's unitary price
          quantity: "3" // Quantity of the product in the cart
        }
        // Add an object for each product in the cart
      ],
      store_id: "1537" // User's store ID
    }
  );
</script>

Order confirmation page

EventParameterExample valueDescriptionRequired?
trackTransactionpage_idEMEA:
trackTransactionDesktop
trackTransactionMobile

AMER:
trackTransaction_desktop
trackTransaction_mobile
Use standard page IDs unless otherwise specified.Yes
trackTransactionid51852389The unique order/transaction ID of the completed purchaseYes
trackTransactionitem[{id:"123", price:3.99, quantity:3}]An array of products in the order with ID, unit price, and quantity. IDs must match the id column of the product feed.Yes
trackTransactionstore_id1537The ID of the specific store that the user is browsing.Only pass this value if your product feed includes regiondata.
<script type="text/javascript" src="//dynamic.criteo.com/js/ld/ld.js?a=#####" async></script>
<script type="text/javascript">
  window.criteo_q = window.criteo_q || [];
  window.criteo_q.push(
    { event: "setAccount", account: "12345" }, // Your partner ID
    { event: "setRetailerVisitorId", id: "0193553C0A39937F23FC" }, // User's guest ID
    { event: "setCustomerId", id: "1SDFJI435FH12HFK2" }, // User's logged-in ID
    { 
      event: "setEmail", 
      email: "d9c378bb0369ee148f7700fc296165d4e8dc356b90ac318be3701ee76f00c588" // User's SHA-256 hashed email
    },
    { event: "setSiteType", type: "d" }, // User's device type
    { 
      event: "trackTransaction",
      page_id: "trackTransaction_mobile", // Platform-specific page ID
      id: "51852389", // User's unique order ID
      item: [
        {
          id: "123", // Purchased product's ID
          price: "3.99", // Purchased product's unitary price
          quantity: "3" // Quantity of the product purchased
        }
        // Add an object for each product in the order
      ],
      store_id: "1537" // User's store ID
    }
  );
</script>