How to use MauticJS API Functions

I want to use “MauticJS API Functions”, but I can’t understand how it works…

I try following code first.

Code:
It works! But I find following notice.
Code:
Mautic tracking is not initiated correctly. Follow the documentation.

How can I use
Code:
MauticJS
?

Thanks!

I want to use “MauticJS API Functions”, but I can’t understand how it works…
I try following code first.

    <script>
        (function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
            w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
            m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
        })(window,document,'script','https://my-mautic.com/mtc.js','mt');

        function test() {
            alert('test');
        }
        MauticJS.documentReady(test);
    </script>

But this code does not workcode:22 Uncaught ReferenceError: MauticJS is not defined[/code]

I try second.

    <script>
        (function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
            w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
            m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
        })(window,document,'script','https://my-mautic.com/mtc.js','mt');

        function test() {
            alert('test');
        }
        mt.documentReady(test);
    </script>

But it does not work too.code:21 Uncaught TypeError: mt.documentReady is not a function[/code]

and finaly, I try to load mtc.js directory.

    <script src="https://marketing.amimoto-ami.com/mtc.js"></script>
    <script>
        function test() {
            alert('test');
        }
        MauticJS.documentReady(test);
    </script>

It works! But I find following notice.Mautic tracking is not initiated correctly. Follow the documentation.

How can I use MauticJS?

Thanks!

You still need to use the tracking script for tracking: https://mautic.org/docs/en/contacts/contact_monitoring.html

Thanks!
You mean if I want to use MauticJS, I should load two mtc.js?

[code]

[/code]

@hideokamoto check the browser properties (in chrome, inspect and security tab). See if you are getting errors loading the script. I gather you are not on the same domain as your mautic installation? if so, check your CORS setting.