From 674e07c43e748d384fb3cfce7c37969dfc01b6ff Mon Sep 17 00:00:00 2001 From: captainbeer Date: Thu, 23 Aug 2018 12:03:14 +0300 Subject: [PATCH] -Events ready --- frontend/web/js/events.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/frontend/web/js/events.js b/frontend/web/js/events.js index a076d62..d1d5baa 100644 --- a/frontend/web/js/events.js +++ b/frontend/web/js/events.js @@ -1,28 +1,30 @@ $(function() { var clicked = null; - $(document) - .on('click', '.modal-link', function() { - console.log('clicked'); + $('.modal-link') + .on('click', function() { clicked = $(this) .data('event'); }); - $(document) - .on('submit', '.section-forms #contact-form', function(e) { - console.log('Form from page'); + $('.section-forms #contact-form') + .on('submit', function() { + dataLayer.push({'event': 'formsend_send'}); }); $(document) - .on('submit', '#callback #contact-form', function(e) { - console.log('Call me maby'); - console.log(clicked); + .on('submit', '#callback #contact-form', function() { + dataLayer.push({'event': 'formsend_callback'}); }); $(document) - .on('submit', '#buy-form #contact-form', function(e) { - console.log('Hello from buy form'); + .on('submit', '#buy-form #contact-form', function() { console.log(clicked); + if (clicked === 'buy1') { + dataLayer.push({'event': 'formsend_order1'}); + } + if (clicked === 'buy2') { + dataLayer.push({'event': 'formsend_order2'}); + } }); - }); \ No newline at end of file -- libgit2 0.21.4