PageSourceSearch

https://www.roellinger-bricourt.com/_themes/famille/theme/bundles/…ncedEcommerce.productClicks.js?v=1686758639

js roellinger-bricourt.com collected 2026-09-26 16:50:06 UTC 2,827 bytes, 80 lines download raw bytes

1(function ( $ ) {
2    'use strict';
3
4    $.fn.extend({
5        enhancedEcommerceProductClickTrigger: function () {
6            $(this).on('click', function (event) {
7                var obj = {
8                    'name': $(this).attr('data-name'),
9                    'id': $(this).attr('data-id')
10                };
11
12                var price = $(this).attr('data-price');
13                if (typeof price !== 'undefined') {
14                    obj.price = price;
15                }
16
17                var brand = $(this).attr('data-brand');
18                if (typeof brand !== 'undefined') {
19                    obj.brand = brand;
20                }
21
22                var category = $(this).attr('data-category');
23                if (typeof category !== 'undefined') {
24                    obj.category = category;
25                }
26
27                var variant = $(this).attr('data-variant');
28                if (typeof variant !== 'undefined') {
29                    obj.variant = variant;
30                }
31
32                var position = $(this).attr('data-position');
33                if (typeof position !== 'undefined') {
34                    obj.position = position;
35                }
36
37                enhancedEcommerceTrackProductClick(obj, $(this).attr('href'), $(this).attr('data-action-field-list'));
38            });
39        }
40    });
41
42    $('a.gtm-eh-track-product-click').enhancedEcommerceProductClickTrigger();
43})( jQuery );
44
45/**
46 * Call this function when a user clicks on a product link. This function uses the event
47 * callback datalayer variable to handle navigation after the ecommerce data has been sent
48 * to Google Analytics.
49 * @param {Object} productObj An object representing a product.
50 * @param {string} clickedUrl URL clicked, browser need to direct there
51 * @param {string} actionFieldList Optional to use as action field list
52 */
53function enhancedEcommerceTrackProductClick(productObj, clickedUrl, actionFieldList) {
54    if (typeof actionFieldList === 'undefined') {
55        actionFieldList = window.actionFieldList || (window.actionFieldList = 'Product List');
56    }
57
58    if (typeof gtmEnhancedEcommerceUAEnabled !== 'undefined' && gtmEnhancedEcommerceUAEnabled) {
59        var obj = {
60            'event': 'productClick',
61            'currencyCode': window.gtmEnhancedEcommerceCurrencyCode || '',
62            'ecommerce': {
63                'click': {
64                    'products': [productObj]
65                }
66            },
67            'eventCallback': function () {
68                document.location = clickedUrl
69            }
70        };
71
72        if (actionFieldList) {
73            obj.ecommerce.click.actionField = {'list': actionFieldList}; // Optional list property.
74        }
75
76        /** global: dataLayer */
77        dataLayer.push({ecommerce: null});
78        dataLayer.push(obj);
79    }
80}

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.