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