A
A
Alexander2020-03-27 04:52:28
JavaScript
Alexander, 2020-03-27 04:52:28

How and where to add Yandex metric targets to buttons created using the WPBakery Page Builder plugin?

Hello! The site has the Woodmart theme installed, the page with the button was created using the WPBakery Page Builder plugin. Plugin version 6.1, WordPress version 5.3.2. The question is, how and where should the code be added to collect the goal statistics created through a javascript event on a button click?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WStanley, 2020-03-27
@WStanley

You can add like this
In the plugin, you can add a class to the button And in the js file to catch the button click event , only jquery must be connected
<button class="myClick">Кнопка</button>

$(document).ready(function() {

    $('.myClick').click(function (event) {
        // сюда добавить фукнцию яндекс метрики
        yandex_function('номер')
    })
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question