vyacheslavkulik
2/9/2017 - 4:21 PM

gtmcalcpush.js

(function() {
    var eventAction;
    
    window.addEventListener('beforeunload', function() {

        var loan-sum = $('.calc_sum').val().replace(/[^0-9]/g, '')*1,
        	loan-period = parseInt($('select.calc_period').val()),
			rate = $('.js-procent').html();

        window.dataLayer.push({
            'event' : 'calcEvent',
            'loan-sum': calcSum,
            'loan-period': calcPeriod,
            'rate': rate,
        });

    });
})();