convead('event', 'EVENT_TYPE', event_properties = {}, visitor_info = {});
convead('event', 'link', {key_page_id: 123}, {});
convead('event', 'purchase', { order_id: '12345', revenue: 99.99, items: [ {product_id: '1', qnt: 1, price: 125.15, product_image_url: 'http://site/2.jpg', product_url: 'http://site.net/product/2'}, {product_id: '2', qnt: 15, price: 127.02, product_image_url: 'http://site/2.jpg', product_url: 'http://site.net/product/2'} ]}, { first_name: 'Сергей', last_name: 'Сергеев', email: 'test@example.net', phone: '555555' } );
convead('event', 'order_update', {order_id: '12345', state: 'paid', revenue: 99.99, items: [ {product_id: '1', qnt: 1, price: 125.15}, {product_id: '2', qnt: 15, price: 127.02} ]});
convead('event', 'update_info', {}, {email: 'test@example.net'});
convead('event', 'view_product', { product_id: '123', product_name: 'Сковородка RX9000', category_id: '123', product_url: window.location.href, price: 125.15, product_image_url: 'http://site/1.jpg' });
convead('event', 'update_cart', { items: [ {product_id: '1', qnt: 1, price: 125.15, product_name: "Сало диетическое", product_url: 'http://site.net/product/1', product_image_url: 'http://site/2.jpg'}, {product_id: '2', qnt: 15, price: 127.02, product_name: "Булочки с маком", product_url: 'http://site.net/product/2', product_image_url: 'http://site/2.jpg'} ] });
convead('event', 'add_to_cart', { product_id: '1', qnt: 2, price: 125.03, product_name: 'Сало диетическое', product_url: 'http://site.net/product/1' });
convead('event', 'remove_from_cart', { product_id: '1', qnt: 2});
convead('event', 'mailto', {email: 'chuck-norris@example.com'}, {});
convead('event', 'file', {file_url: 'http://example.com/file.zip'}, {});
convead('widget', 'show', {id: 123}); convead('widget', 'show', {id: 123, on_complete: function(el) { alert(el); }}); convead('widget', 'show', {id: 123, allow_close: false});
convead('widget', 'close'); convead('widget', 'close', {id: 123}); convead('widget', 'close', {display_type: 'manual'});
convead('track', 'disable');
convead('track', 'enable');
convead('module', 'chat', {method: 'show'});
convead('module', 'chat', {method: 'hide'});
ConveadSettings.onload = function() { console.log('loaded'); }; ConveadSettings.onready = function() { console.log('ready'); } ConveadSettings.onevent = function(event_name, properties, visitor_info, attributes) { console.log('event', event_name, properties, visitor_info, attributes); }
ConveadSettings.onready = function() { ConveadClient.event_emitter.subscribe('event.view_product', function() { console.log('View product event was sent'); }); ConveadClient.event_emitter.subscribe('find_email', function(email) { console.log('Your email is', email); }); ConveadClient.event_emitter.subscribe('chat.show', function() { console.log('Chat is open'); }); ConveadClient.event_emitter.subscribe('chat.hide', function() { console.log('Chat is close'); }); ConveadClient.event_emitter.subscribe('chat.send_msg', function(msg) { console.log('The visitor sent a message', msg); }); ConveadClient.event_emitter.subscribe('chat.new_msg', function(msg) { console.log('The visitor has received a new message', msg); }); ConveadClient.event_emitter.subscribe('chat.unread_msg', function(msg) { console.log('Visitor has unread messages', msg); }); ConveadClient.event_emitter.subscribe('chat.entered_msg', function(msg) { console.log('Chat init', msg); }); ConveadClient.event_emitter.subscribe('leaving', function() { console.log('The browser window is closed'); }); };