Commit 3c97dbc1adab1e1f2f0cded333fb0308a1ddb3a6

Authored by alex
2 parents 6976ddff 674e07c4

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	frontend/web/js/events.js
Showing 1 changed file with 10 additions and 19 deletions   Show diff stats
frontend/web/js/events.js
1 $(function() { 1 $(function() {
2 var clicked = null; 2 var clicked = null;
3 - var btn1=null;  
4 - $(document)  
5 - .on('click', '.modal-link', function() {  
6 - console.log('clicked'); 3 +
  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() {
14 dataLayer.push({'event': 'formsend_send'}); 12 dataLayer.push({'event': 'formsend_send'});
15 }); 13 });
16 14
17 $(document) 15 $(document)
18 - .on('submit', '#callback #contact-form', function(e) {  
19 - // console.log('Call me maby'); 16 + .on('submit', '#callback #contact-form', function() {
20 dataLayer.push({'event': 'formsend_callback'}); 17 dataLayer.push({'event': 'formsend_callback'});
21 - // console.log(clicked);  
22 }); 18 });
23 19
24 $(document) 20 $(document)
25 - .on('submit', '#buy-form #contact-form', function(e) {  
26 - // console.log('Hello from buy form');  
27 - if(btn1=='buy1')  
28 - { 21 + .on('submit', '#buy-form #contact-form', function() {
  22 + console.log(clicked);
  23 + if (clicked === 'buy1') {
29 dataLayer.push({'event': 'formsend_order1'}); 24 dataLayer.push({'event': 'formsend_order1'});
30 } 25 }
31 - else { 26 + if (clicked === 'buy2') {
32 dataLayer.push({'event': 'formsend_order2'}); 27 dataLayer.push({'event': 'formsend_order2'});
33 } 28 }
34 - // console.log(clicked);  
35 }); 29 });
36 - $('.modal-link').on('click',function () {  
37 - btn1=(this.dataset.event);  
38 - })  
39 }); 30 });
40 \ No newline at end of file 31 \ No newline at end of file