A
A
Alexander2018-10-03 15:47:57
JavaScript
Alexander, 2018-10-03 15:47:57

How to set a metric target for buttons with the same class?

There are many buttons on the site with the same .button-submit class, I want to put an onclick metric event on them, but the code that displays these buttons is somewhere in the wilds of files.

I would like some kind of script that can be thrown, for example, in the header and not look for the button output code

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Proskurin, 2018-10-03
@Vlad_IT

$('body').on('click', '.button-submit', function () {
   // код
});

A
Andrey Kurtuchkin, 2018-10-03
@AndreyKurtuchkin

Try google tag manager.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question