PageSourceSearch

https://www.vintageprints.co.uk/catalog/view/javascript/compgapro.js

js vintageprints.co.uk collected 2026-10-07 07:33:50 UTC 3,481 bytes, 86 lines download raw bytes

1function compgapro_trackevent(product_id, eventname) {
2	pagename = $(document).find("title").text(); 
3	$.ajax({
4		url: 'index.php?route=extension/compgapro/trackevent',
5		type: 'post', dataType: 'json', cache: false,
6		data: { product_id: product_id, pagename: pagename },		
7		success: function(json) {
8			ga('ec:addProduct', json['items']);
9			if(eventname == 'remove_from_cart') { ga('ec:setAction', 'remove'); } 
10			else { ga('ec:setAction', 'add'); }
11			ga('send', 'event', pagename, eventname, json['items'].name);
12		}
13	});
14}
15function compgapro_trackchkstp(stepid, stepname) {
16	$.ajax({
17		url: 'index.php?route=extension/compgapro/trackchkstp',
18		dataType: 'json', cache: false,
19		success: function(json) {
20			for(var i = 0; i < json['items'].length; i++) {
21			ga('ec:addProduct', json['items'][i]);
22			}
23			ga('ec:setAction','checkout', {'step': stepid, 'option': stepname});
24			ga('send', 'pageview');
25		}
26	});
27}
28
29function load_compgapro() { 
30$("[onclick*='cart.add']").each(function() {
31	var product_id = $(this).attr('onclick').match(/[0-9]+/);
32	var func = 'compgapro_trackevent('+product_id+', \''+$(this).find('span').html()+'\');';
33	$(this).attr('onclick',func+$(this).attr('onclick'));
34});
35$("[onclick*='cart.remove']").each(function() {
36	var product_id = $(this).attr('onclick').match(/[0-9]+/);
37	var func = 'compgapro_trackevent('+product_id+', \'remove_from_cart\');';
38	$(this).attr('onclick',func+$(this).attr('onclick'));
39});
40$("[onclick*='wishlist.add']").each(function() {
41	var product_id = $(this).attr('onclick').match(/[0-9]+/);
42	var func = 'compgapro_trackevent('+product_id+', \''+$(this).attr('title')+'\');';
43	$(this).attr('onclick',func+$(this).attr('onclick'));
44});
45$("[onclick*='compare.add']").each(function() {
46	var product_id = $(this).attr('onclick').match(/[0-9]+/);
47	var func = 'compgapro_trackevent('+product_id+', \''+$(this).attr('title')+'\');';
48	$(this).attr('onclick',func+$(this).attr('onclick'));
49});
50var product_id_page = $("input[name='product_id']").val();
51if (typeof product_id_page !== 'undefined') {
52	var func = 'compgapro_trackevent('+product_id_page+', \''+$('#button-cart').html()+'\');';
53	$('#button-cart').attr('onclick',func);
54}
55}
56
57pageurl = window.location.href;
58if(pageurl.indexOf('login') != -1) { ga('send', 'event', 'Account', 'Login', 'Signin'); }
59if(pageurl.indexOf('register') != -1) { ga('send', 'event', 'Account', 'Register', 'Signup'); }
60
61// begin checkout
62if(pageurl.indexOf('checkout') != -1) {
63$(document).delegate('#button-register', 'click', function() {
64	compgapro_trackchkstp(2, 'Billing Details');
65	compgapro_trackchkstp(3, 'Delivery Details');
66});
67$(document).delegate('#button-guest', 'click', function() {
68	compgapro_trackchkstp(2, 'Billing Details');
69	compgapro_trackchkstp(3, 'Delivery Details');
70});
71$(document).delegate('#button-payment-address', 'click', function() {
72	compgapro_trackchkstp(2, 'Customer Billing Details');
73});
74$(document).delegate('#button-shipping-address', 'click', function() {
75	compgapro_trackchkstp(3, 'Customer Billing Details');
76});
77$(document).delegate('#button-shipping-method', 'click', function() {
78	compgapro_trackchkstp(4, 'Shipping Method'); 
79});
80$(document).delegate('#button-payment-method', 'click', function() {
81	compgapro_trackchkstp(5, 'Payment Method'); 
82});
83$(document).delegate('#button-confirm', 'click', function() {
84	compgapro_trackchkstp(6, 'Checkout Confirm'); 
85});
86}

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.