Skip to main content

So, browser sdk 2 documentation states that the way to load SDK is just to reference script:

<script src="https://cdn.amplitude.com/libs/analytics-browser-2.10.0-min.js.gz"></script>

<script>

    window.amplitude.init("AMPLITUDE_API_KEY", {

    autocapture: { elementInteractions: true }

});

</script>

 

However, all other places I saw imply on having a script with that manually inserts <script> tag using javascript, while doing lots of other stuff like checking for double-initialization (See “installing via script loader” section of npm package description)

What is the proper way to go?
If it’s the 2nd one, what are all these things that this script do?

Be the first to reply!

Reply