0

I am needing to track a click on a link in Google Analytics so I am adding the below to the footer of my Magento 2.3 website. I have jquery on the site but for some reason the below cost is not working. I don't see the click in GA nor do I see my message in the console. I am not sure what I am doing incorrect.

require(['jquery'],function($){
$(document).ready(function(){
 $(".ink-refilling-suggestion").click(function(){
 ga(‘send’, ‘event’, ‘ Refill Finder’, ‘Click’, 'Refill Finder View');
 console.log('count refill finder click');
 })
});
});
asked Aug 18, 2021 at 0:40
1
  • Does console log print or not? Commented Aug 18, 2021 at 10:44

1 Answer 1

0

check below code

require([
 'jquery'
], function ($) {
 'use strict';
 $(document).ready(function () {
 $(document).on('click', 'ink-refilling-suggestion', function() {
 console.log('here');
 });
 });
});
answered Aug 18, 2021 at 10:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.