Adding the JavaScript SDK

Adding the JavaScript SDK to your web application is fast and simple. Just follow these steps and you’ll be up and running..

Add the Medio SDK

  1. Download the Medio JavaScript SDK.
  2. Unzip the downloaded file and locate the folder named medioevensdk-[VERSION], where [VERSION] is the current version of the SDK.
  3. Copy the medioeventsdk-[VERSION] folder to the root of your web application. Make sure that this directory is deployed with your web application to the web server.

Modify your pages

  1. Include the medioeventsdk-[VERSION].js file in your HTML page’s head section:
    <script type="text/javascript" src="medioeventsdk-[VERSION]/medioeventsdk-[VERSION].js"></script>
    
  2. Add the following function inside your HTML page’s head section. We’ll provide you with an API key for your app (shown as API_KEY in the code below) when you sign up with Medio.
    <script>
        function initEventSDK() {
            Medio.EventApi.initialize(API_KEY);
            Medio.EventApi.logPageRequest();
        }
        window.onload = initEventSDK;
    </script>