PageSourceSearch

https://newworldlibrary.com/wp-content/plugins/klaviyo/includes/js/wck-viewed-product.js?ver=3.8.3

js newworldlibrary.com collected 2026-09-24 08:54:59 UTC 1,995 bytes, 46 lines download raw bytes

1/**
2 * WCK Viewed Product
3 *
4 * Incoming product object
5 * @typedef {Object} item
6 *   @property {string} title - Product name
7 *   @property {int} product_id - Parent product ID
8 *   @property {int} variant_id - Product ID
9 *   @property {string} url - Product permalink
10 *   @property {string} image_url - Product image url
11 *   @property {float} price - Product price
12 *   @property {array} categories - Product categories (array of strings)
13 *
14 * Unfortunately wp_localize_script converts all variables to strings :( so we
15 * will have to re-parse ints and floats.
16 * See note in - https://codex.wordpress.org/Function_Reference/wp_localize_script
17 *
18 */
19
20function trackViewedProduct() {
21    var klaviyo = window.klaviyo || [];
22    var track_viewed_item = {
23        'Title': item.title,
24        'ItemId': parseInt(item.product_id),
25        'variantId': parseInt(item.variant_id),
26        'Categories': item.categories,
27        'ImageUrl': item.image_url,
28        'Url': item.url,
29        '$value': parseFloat(item.price),
30        'Metadata': {
31            'Price': parseFloat(item.price),
32        }
33    };
34    var viewed_item = {
35        ...track_viewed_item,
36        'ProductID': parseInt(item.product_id),
37    };
38
39    klaviyo.push(['track', 'Viewed Product', viewed_item]);
40    klaviyo.push(['trackViewedItem', track_viewed_item]);
41};
42
43window.addEventListener("load", function() {
44  !function(){if(!window.klaviyo){window._klOnsite=window._klOnsite||[];try{window.klaviyo=new Proxy({},{get:function(n,i){return"push"===i?function(){var n;(n=window._klOnsite).push.apply(n,arguments)}:function(){for(var n=arguments.length,o=new Array(n),w=0;w<n;w++)o[w]=arguments[w];var t="function"==typeof o[o.length-1]?o.pop():void 0,e=new Promise((function(n){window._klOnsite.push([i].concat(o,[function(i){t&&t(i),n(i)}]))}));return e}}})}catch(n){window.klaviyo=window.klaviyo||[],window.klaviyo.push=function(){var n;(n=window._klOnsite).push.apply(n,arguments)}}}}();
45  trackViewedProduct();
46});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.