PageSourceSearch

https://www.editionspixnlove.com/modules/ganalytics/views/js/GoogleAnalyticActionLib.js

js editionspixnlove.com collected 2026-10-02 06:56:30 UTC 4,617 bytes, 178 lines download raw bytes

1/**
2 * 2007-2015 PrestaShop
3 *
4 * NOTICE OF LICENSE
5 *
6 * This source file is subject to the Academic Free License (AFL 3.0)
7 * that is bundled with this package in the file LICENSE.txt.
8 * It is also available through the world-wide-web at this URL:
9 * http://opensource.org/licenses/afl-3.0.php
10 * If you did not receive a copy of the license and are unable to
11 * obtain it through the world-wide-web, please send an email
12 * to [email protected] so we can send you a copy immediately.
13 *
14 * DISCLAIMER
15 *
16 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
17 * versions in the future. If you wish to customize PrestaShop for your
18 * needs please refer to http://www.prestashop.com for more information.
19 *
20 *  @author    PrestaShop SA <[email protected]>
21 *  @copyright 2007-2015 PrestaShop SA
22 *  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
23 *  International Registered Trademark & Property of PrestaShop SA
24 **/
25
26/* globals $, ga, jQuery */
27
28var GoogleAnalyticEnhancedECommerce = {
29
30	setCurrency: function(Currency) {
31		ga('set', '&cu', Currency);
32	},
33
34	add: function(Product, Order, Impression) {
35		var Products = {};
36		var Orders = {};
37
38		var ProductFieldObject = ['id', 'name', 'category', 'brand', 'variant', 'price', 'quantity', 'coupon', 'list', 'position', 'dimension1'];
39		var OrderFieldObject = ['id', 'affiliation', 'revenue', 'tax', 'shipping', 'coupon', 'list', 'step', 'option'];
40
41		if (Product != null) {
42			if (Impression && Product.quantity !== undefined) {
43				delete Product.quantity;
44			}
45
46			for (var productKey in Product) {
47				for (var i = 0; i < ProductFieldObject.length; i++) {
48					if (productKey.toLowerCase() == ProductFieldObject[i]) {
49						if (Product[productKey] != null) {
50							Products[productKey.toLowerCase()] = Product[productKey];
51						}
52
53					}
54				}
55
56			}
57		}
58
59		if (Order != null) {
60			for (var orderKey in Order) {
61				for (var j = 0; j < OrderFieldObject.length; j++) {
62					if (orderKey.toLowerCase() == OrderFieldObject[j]) {
63						Orders[orderKey.toLowerCase()] = Order[orderKey];
64					}
65				}
66			}
67		}
68
69		if (Impression) {
70			ga('ec:addImpression', Products);
71		} else {
72			ga('ec:addProduct', Products);
73		}
74	},
75
76	addProductDetailView: function(Product) {
77		this.add(Product);
78		ga('ec:setAction', 'detail');
79		ga('send', 'event', 'UX', 'detail', 'Product Detail View',{'nonInteraction': 1});
80	},
81
82	addToCart: function(Product) {
83		this.add(Product);
84		ga('ec:setAction', 'add');
85		ga('send', 'event', 'UX', 'click', 'Add to Cart'); // Send data using an event.
86	},
87
88	removeFromCart: function(Product) {
89		this.add(Product);
90		ga('ec:setAction', 'remove');
91		ga('send', 'event', 'UX', 'click', 'Remove From cart'); // Send data using an event.
92	},
93
94	addProductImpression: function(Product) {
95		//ga('send', 'pageview');
96	},
97
98	/**
99	id, type, affiliation, revenue, tax, shipping and coupon.
100	**/
101	refundByOrderId: function(Order) {
102		/**
103		 * Refund an entire transaction.
104		 **/
105		ga('ec:setAction', 'refund', {
106			'id': Order.id // Transaction ID is only required field for full refund.
107		});
108		ga('send', 'event', 'Ecommerce', 'Refund', {'nonInteraction': 1});
109	},
110
111	refundByProduct: function(Order) {
112		/**
113		 * Refund a single product.
114		 **/
115		//this.add(Product);
116
117		ga('ec:setAction', 'refund', {
118			'id': Order.id, // Transaction ID is required for partial refund.
119		});
120		ga('send', 'event', 'Ecommerce', 'Refund', {'nonInteraction': 1});
121	},
122
123	addProductClick: function(Product) {
124		var ClickPoint = jQuery('a[href$="' + Product.url + '"].quick-view');
125
126		ClickPoint.on("click", function() {
127			GoogleAnalyticEnhancedECommerce.add(Product);
128			ga('ec:setAction', 'click', {
129				list: Product.list
130			});
131
132			ga('send', 'event', 'Product Quick View', 'click', Product.list, {
133				'hitCallback': function() {
134					return !ga.loaded;
135				}
136			});
137		});
138
139	},
140
141	addProductClickByHttpReferal: function(Product) {
142		this.add(Product);
143		ga('ec:setAction', 'click', {
144			list: Product.list
145		});
146
147		ga('send', 'event', 'Product Click', 'click', Product.list, {
148			'nonInteraction': 1,
149			'hitCallback': function() {
150				return !ga.loaded;
151			}
152		});
153
154	},
155
156	addTransaction: function(Order) {
157
158		//this.add(Product);
159		ga('ec:setAction', 'purchase', Order);
160		ga('send', 'event','Transaction','purchase', {
161			'hitCallback': function() {
162				$.get(Order.url, {
163					orderid: Order.id,
164					customer: Order.customer
165				});
166			}
167		});
168
169	},
170
171	addCheckout: function(Step) {
172		ga('ec:setAction', 'checkout', {
173			'step': Step
174			//'option':'Visa'
175		});
176		//ga('send', 'pageview');
177	}
178};

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.