Commit d0b13318f2450b2fbddfa4db48f275b9e8b3ac24

Authored by Alexey Boroda
1 parent 484adcb4

-Form custom event

frontend/controllers/SiteController.php
... ... @@ -171,6 +171,7 @@
171 171 'success' => true,
172 172 'message' => 'Success message',
173 173 'alert' => $alert,
  174 + 'type' => $type,
174 175 ];
175 176 } else {
176 177 Yii::$app->response->setStatusCode(500);
... ...
frontend/web/js/modal.js
... ... @@ -59,6 +59,9 @@ $(
59 59 data: formData,
60 60 success: function(data) {
61 61 f.reset();
  62 + if (data.type == 'appointment') {
  63 + dataLayer.push({'event': 'mainFormSub'});
  64 + }
62 65 // form.replaceWith(data.alert)
63 66 // $(".modal-dialog").append(data.alert);
64 67 // setTimeout(function(){location.reload()}, 5000);
... ... @@ -66,8 +69,7 @@ $(
66 69 $(".success_").animate({opacity: 1, top: '40'}, 200).addClass("done_");
67 70 setTimeout(function(){$(".success_").animate({opacity: 0, top: '0'}, 200,function(){
68 71 $(this).removeClass("done_");
69   - })}, 4000);
70   -
  72 + })}, 4000)
71 73 },
72 74 error: function() {
73 75  
... ...