• Resolved retaillabs

    (@retaillabs)


    I have created an event to track called AWIN, and want to track clicks on the READY TO BUY? button the linked page and similar pages.

    Elementor buttons have a field to add a CSS Class to the button, and I have added the following: koko-analytics-event-name=AWIN

    However, there is nothing showing as being tracked. What have I missed please?

    • This topic was modified 11 months ago by retaillabs.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Lap

    (@lapzor)

    Are you using the pro version with event tracking? Event tracking is not available in the free version.

    https://www.kokoanalytics.com/pricing/


    Did you create the event in the Koko settings screen? The event name needs to be exactly the same, case sensitive too.

    Kind regards,

    Thread Starter retaillabs

    (@retaillabs)

    Yes I have bought 3 license seats, and yes I setup the event.

    Plugin Support Lap

    (@lapzor)

    It seems Elementor doesn’t add the class to the A tag (the thing you click on) but to a DIV tag above it

    image.png

    Instead of the koko tracking class I recommend you use some unique class name to select the button by, in this example I used the class name “my-button” and then use a tracking code snippet like this:

    window.addEventListener(‘load’, function() {
    // Your custom event tracking logic goes here:
    document.querySelector(‘.my-button a’).addEventListener(‘click’, function() {
    koko_analytics.trackEvent(‘AWIN’, ‘From page: ‘ + window.location.pathname);
    });
    });

    The selector .my-button a will look for an a tag (link) that is within an element (eg div in this case) that has the class my-button (dot indicates a class).

    Hope that helps. If you have any questions, please let me know!

    Thread Starter retaillabs

    (@retaillabs)

    I am not a coder, so where do I put the code you suggest?

    • This reply was modified 11 months ago by retaillabs.
    Plugin Support Lap

    (@lapzor)

    It’s a javascript code snippet.

    If it’s specific to only this page, you can add it to the page via a HTML block in elementor: https://elementor.com/help/edit-html-elementor/ (or if you would be using the normal block editor via a HTML code block)

    You just need to add script tags around it in that case:

    <script>
    window.addEventListener(‘load’, function() {
    // Your custom event tracking logic goes here:
    document.querySelector(‘.my-button a’).addEventListener(‘click’, function() {
    koko_analytics.trackEvent(‘AWIN’, ‘From page: ‘ + window.location.pathname);
    });
    });
    </script>


    Of if you want to check for this button on every page on your site you can use a plugin like the Code Snippets plugin.

    Hope that helps. If you have any questions, please let me know!

    Thread Starter retaillabs

    (@retaillabs)

    Hmm, can’t get that to work at all….

    Plugin Support Lap

    (@lapzor)

    can you be more specific as to where you are stuck with this?


    I don’t see the script added to your page yet.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Event Tracking with Elementor Button’ is closed to new replies.