A
A
Andrey2021-12-22 19:11:54
JavaScript
Andrey, 2021-12-22 19:11:54

How to correctly insert google attribute js?

How to add google tracking code to button?
google writes like this

Как добавить код в кнопку. Здесь показано, как настроить отслеживание нажатий кнопки с помощью тега <button>. Подставьте вместо "http://example.com/your-link" URL своего сайта.

<button onclick="return gtag_report_conversion('http://example.com/your-link')">Отправить</button>

but when the button is already onclick for example
<button type="button" onclick="cart.add('<?php echo $product['product_id']; ?>');"><?php echo $button_cart; ?></button>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
migop10654, 2021-12-23
@migop10654

So add this function inside cart.add
After this line:
https://github.com/opencart/opencart/blob/8b4144ed...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question