PageSourceSearch

https://www.bug.co.il/Scripts/googleAnalyticsEE.js?=20260224

js bug.co.il collected 2026-10-02 05:50:54 UTC 9,633 bytes, 285 lines download raw bytes

1
2var dataLayer = window.dataLayer || [];
3
4jQuery(document).ready(function () {
5
6    $(document.body).delegate(".pc-gaee[data-statusid='10'] .tpurl", "click", function (e) {
7        e.preventDefault();
8        var productCube = $(this).parents(".product-cube");
9        var url = $(this).prop("href");
10        gaeeProductClick(productCube, url);
11    });
12});
13
14function gaeeImpressions(arr, list) {
15    var products = [];
16    $(arr).each(function () {
17        list = list.replace(/\"/gi, """);
18        var obj = gaeeProductCubeCollect(this);
19        obj.list = list;
20        products.push(obj);
21        $(this).addClass("gaee-impression").attr("data-list", list);
22    });
23    gaeeDataLayerPushImpressions(products);
24}
25
26function gaeeProductClick(elem, url) {
27    var products = [];
28    products.push(gaeeProductCubeCollect(elem));
29    var listObj = {};
30    if (typeof(products[0].list) != "undefined" && products[0].list != "") {
31        listObj = { 'list': products[0].list };
32    }
33    gaeeDataLayerPush("eec.impressionClick", "click", listObj, products, function () {
34        window.location = url;
35    });
36}
37
38function gaeeProductPageCollect() {
39    var variant = "";
40    try {
41        var color = $("#product-page .product-variation-option-button[name='product-color-input']:checked");
42        if (color.length > 0) {
43            variant += " " + $(color).parents(".color-container").find(".color-name").prop("title");
44        }
45    }
46    catch (ex) { }
47
48    try {
49        $("#product-page .other-variation-or-upgrade-container.other-variation .product-variation-option-button").each(function () {
50            var optionSelected = $(this).find("option:selected");
51            if ($(optionSelected).length > 0) {
52                variant += " " + $(optionSelected).text();
53            }
54        });
55    }
56    catch (ex) { }
57
58    return {
59        'id': productID,
60        'name': productName,
61        'category': categoryName,
62        'price': $("#product-page #product-price-container ins").text().replace(/₪/gi, "").replace(/,/gi, "").trim(),
63        'brand': manufacturerName,
64        'variant': variant
65    };
66}
67
68function gaeeProductPageLoad() {
69    var products = [];
70    products.push(gaeeProductPageCollect());
71    gaeeDataLayerPush('eec.detail', 'detail', {}, products);//{ 'list': "דף מוצר" }-לבקשת עמרי 03.08.2020
72}
73
74function gaeeAddToBasketFromProductPage(bundleIds, upgradeIds) {
75    var products = [];
76    products.push(gaeeProductPageCollect());
77    products[0].quantity = 1;
78
79    if (typeof (bundleIds) != "undefined") {
80        var ids = bundleIds.split(",");
81        var bundleContainer = $("#real-bundle-container");//bundleIds לא יהיה related-as-bundle$(".product-bundle-container");
82        for (var i = 0; i < ids.length; i++) {
83            if (ids[i] != "") {
84                var bundleCube = $(bundleContainer).find(".bundle-image-cube[data-bundle-product-id='" + ids[i] + "']");
85                if (bundleCube.length > 0) {
86                    var obj = gaeeProductBundleCollect(bundleCube);
87                    obj.quantity = 1;
88                    obj.price = $(bundleCube).attr("data-price");
89                    obj.id = $(bundleCube).attr("data-bundle-product-id");
90                    products.push(obj);
91                }
92            }
93        }
94    }
95    if (typeof (upgradeIds) != "undefined") {
96        var ids = upgradeIds.split(",");
97        var bundleContainer = $("#upgrades-content-container");
98        for (var i = 0; i < ids.length; i++) {
99            if (ids[i] != "") {
100                var upgradeCube = $(bundleContainer).find(".other-variation-or-upgrade-container.other-upgrade option:selected[value='" + ids[i] + "']");
101                if (upgradeCube.length > 0) {
102                    var obj = gaeeProductBundleCollect(upgradeCube);
103                    obj.quantity = 1;
104                    obj.price = $(upgradeCube).attr("data-price");
105                    obj.id = $(upgradeCube).val();
106                    products.push(obj);
107                }
108            }
109        }
110    }
111
112    gaeeDataLayerPush('eec.add', 'add', {}, products);//{ 'list': "דף מוצר" }-לבקשת עמרי 03.08.2020
113    //gaeeProductsAddedToBasket(products);
114}
115
116function gaeeAddToBasketFromProductCube(elem) {
117    var products = [];
118    products.push(gaeeProductCubeCollect(elem));
119    products[0].quantity = 1;
120    var listObj = {};
121    if (typeof (products[0].list) != "undefined" && products[0].list != "") {
122        listObj = { 'list': products[0].list };
123    }
124    gaeeDataLayerPush('eec.add', 'add', listObj, products);
125    //gaeeProductsAddedToBasket(products);
126}
127
128function gaeeProductCubeCollect(elem) {
129    return {
130        id: $(elem).attr("data-prodid"),
131        name: $(elem).attr("data-fullName"),
132        category: $(elem).attr("data-category"),
133        price: $(elem).find(".price").find("span").text().replace(/₪/gi, "").replace(/,/gi, "").trim(),
134        brand: $(elem).attr("data-manufacturer"),
135        position: $(elem).attr("data-index"),
136        list: $(elem).attr("data-list")
137    };
138}
139
140function gaeeProductBundleCollect(elem) {
141    return {
142        id: $(elem).attr("data-prodid"),
143        name: $(elem).attr("data-fullName"),
144        category: $(elem).attr("data-category"),
145        price: $(elem).find(".pprice").text().replace(/₪/gi, "").replace(/,/gi, "").trim(),
146        brand: $(elem).attr("data-manufacturer")
147    };
148}
149
150function gaeePageBasketCollect(rows) {
151    if (typeof (rows) == "undefined") {
152        rows = $("#basketTable .basket-row.book-cube");
153    }
154    var products = [];
155    $(rows).each(function () {
156        products.push({
157            id: $(this).attr("data-prodid"),
158            name: $(this).find(".basket-row-product-name > a").text(),
159            brand: $(this).attr("data-manufacturer"),
160            category: $(this).attr("data-category"),
161            quantity: $(this).attr("data-quantity"),
162            price: $(this).find(".basket-row-product-price").text().trim().replace(/₪/gi, "").replace(",", "").replace(",", ""),
163            variant: $(this).attr("data-variant")
164        });
165    });
166    return products;
167}
168
169function gaeeRemoveProductFromBasket(rowsArr, list, quantity) {
170    var products;
171    products = gaeePageBasketCollect(rowsArr);
172    if (typeof (quantity) != "undefined") {
173        $(products).each(function () {
174            this.quantity = quantity;
175        });
176    }
177    gaeeDataLayerPush('eec.remove', 'remove', {}, products);//{ 'list': list } לבקשת עמרי 03.08.2020
178}
179
180function gaeeAddProductFromBasketPage(rowsArr, list, quantity) {
181    var products;
182    products = gaeePageBasketCollect(rowsArr);
183    if (typeof (quantity) != "undefined") {
184        $(products).each(function () {
185            this.quantity = quantity;
186        });
187    }
188    gaeeDataLayerPush('eec.add', 'add', {}, products);//{ 'list': list } לבקשת עמרי 03.08.2020
189}
190
191function gaeeCheckout(step) {
192    var rows = undefined;
193    if (step == 2 || step == 3) {
194        rows = $("#basketTable .basket-row:not(.basket-header-row)");
195    }
196    var products = gaeePageBasketCollect(rows);
197    gaeeDataLayerPush('eec.checkout', 'checkout', { 'step': step }, products);
198}
199
200function gaeeDataLayerPushPurchase(actionField,products,test,orderGuid) {
201    gaeeDataLayerPush('eec.purchase', 'purchase', actionField, products,undefined, orderGuid);
202}
203
204function gaeeDataLayerPush(event, ecommerceObjKey, actionField, products, eventCallback, fb_event_id) {
205
206    if (isValidToGA()) {
207        var ecommerceObj = {};
208        ecommerceObj[ecommerceObjKey] = {
209            'actionField': actionField,
210            'products': products,
211            'currencyCode': 'ILS'
212        };
213
214        var eventObj = {
215            'event': event,
216            'ecommerce': ecommerceObj,
217            'fb_event_id': fb_event_id
218        };
219
220        if (typeof (eventCallback) != "undefined") {
221            eventObj["eventCallback"] = eventCallback;
222        }
223
224        console.log("gaeeDataLayerPush");
225        console.log(eventObj);
226        dataLayer.push(eventObj);
227
228
229        if (typeof (eventCallback) != "undefined") {
230            setTimeout(eventCallback, 1000);
231        }
232    }
233    else {
234        if (typeof (eventCallback) != "undefined") {
235            eventCallback();
236        }
237    }
238}
239
240function gaeeDataLayerPushImpressions(products) {
241
242    var eventObj = {
243        'event': 'eec.impressionView',
244        'currencyCode': 'ILS',
245        'ecommerce': {
246            'impressions': products
247        }
248    };
249
250    console.log("eec.impressionView");
251    console.log(eventObj);
252    dataLayer.push(eventObj);
253}
254
255function gaeeDataLayerPushPageDetails(page_title, page_type) {
256
257    if (isValidToGA()) {
258
259        var obj = {
260            'page_title': page_title,
261            'Page_Type': page_type
262        };
263
264        dataLayer.push(obj);
265    }
266}
267
268function isValidToGA() {
269    return window.bug_global.is_snippet_loaded && window.ga;// && ga.loaded;
270}
271
272
273function sendGtagEvent(eventName, eventParams) {
274    debugger;
275    try {
276        //if (typeof gtag === 'function') {
277        if (isValidToGA()) {
278            //gtag('event', eventName);
279            dataLayer.push({ 'event':eventName, 'ecommerce':eventParams});
280            console.log("gtag event sent: " + eventName + " with the parameters:");
281            console.log(eventParams);
282        }
283    }
284    catch (ex) { }
285}

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.