Created
January 23, 2020 17:12
-
-
Save MrSwed/9d499a330c641f630806e9e7c0c41645 to your computer and use it in GitHub Desktop.
WordPress NinjaForm Yandex metric Targeting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
// Setup Ninja form - on Sumbit Yandex metric targeting. | |
$(document).on('nfFormSubmitResponse', function(e, r){ | |
var Target = "form-"+r.id, | |
YMVar = $(document.scripts).filter(function(){ return /w.yaCounter\d+/.test($(this).text()) }).text().replace(/^.*w.(yaCounter\d+)\s+.*$/im, "$1"); | |
if (YMVar && window[YMVar]) window[YMVar].reachGoal(Target); | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment