Commit 674e07c43e748d384fb3cfce7c37969dfc01b6ff

Authored by Alexey Boroda
1 parent 5ca433ff

-Events ready

Showing 1 changed file with 14 additions and 12 deletions   Show diff stats
frontend/web/js/events.js
1 $(function() { 1 $(function() {
2 var clicked = null; 2 var clicked = null;
3 3
4 - $(document)  
5 - .on('click', '.modal-link', function() {  
6 - console.log('clicked'); 4 + $('.modal-link')
  5 + .on('click', function() {
7 clicked = $(this) 6 clicked = $(this)
8 .data('event'); 7 .data('event');
9 }); 8 });
10 9
11 - $(document)  
12 - .on('submit', '.section-forms #contact-form', function(e) {  
13 - console.log('Form from page'); 10 + $('.section-forms #contact-form')
  11 + .on('submit', function() {
  12 + dataLayer.push({'event': 'formsend_send'});
14 }); 13 });
15 14
16 $(document) 15 $(document)
17 - .on('submit', '#callback #contact-form', function(e) {  
18 - console.log('Call me maby');  
19 - console.log(clicked); 16 + .on('submit', '#callback #contact-form', function() {
  17 + dataLayer.push({'event': 'formsend_callback'});
20 }); 18 });
21 19
22 $(document) 20 $(document)
23 - .on('submit', '#buy-form #contact-form', function(e) {  
24 - console.log('Hello from buy form'); 21 + .on('submit', '#buy-form #contact-form', function() {
25 console.log(clicked); 22 console.log(clicked);
  23 + if (clicked === 'buy1') {
  24 + dataLayer.push({'event': 'formsend_order1'});
  25 + }
  26 + if (clicked === 'buy2') {
  27 + dataLayer.push({'event': 'formsend_order2'});
  28 + }
26 }); 29 });
27 -  
28 }); 30 });
29 \ No newline at end of file 31 \ No newline at end of file