javascriptmixpanel

Mixpanel tracking not working


I'm new to mixpanel and JS, and would like to know why is my script not working... Any ideas?

<script>
    $('#tp_end_result').hover(function () {
        mixpanel.track("Hover Spot");
        console.log("Funciona");
    });
</script>

Thanks


Solution

  • The javascript code above is perfectly fine.

    As you are not seeing any tracking for mixpanel, probably you might see the initialization code.

    Just a quick recap, we need to import JS library into the HEAD tags, at the end of library, there is code of initialization of mixpanel:

    mixpanel.init("YOUR TOKEN");

    Here "YOUR TOKEN" should be replaced with token of respective project from you account. [See attached screenshot]

    enter image description here

    Please put your comments if still not works for you