moytop,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
document.addEventListener('DOMContentLoaded', function() {
let onsubmit = "ym(777,'reachGoal','ppp'); return true;";
document.querySelectorAll('[method="post"]').forEach(elem => elem.setAttribute('onsubmit', onsubmit));
});
</script>
</head>
<body>
<form action="#" method="post">
<input name="lead_name" type="text" placeholder="Введите ваше имя">
<input name="lead_email" type="text" placeholder="Введите ваш e-mail">
<input type="submit" value="Отправить">
</form>
</body>
</html>