We suggest the following steps:

  1. Getting Started - Add the script to your pages
    The first step is to get your client Id for the script. Your Project Manager will provide you with this Id. Then, on each page you want to track, add this script in the page head tag:
                        
    <script type="text/javascript" src="http://ws.aimbase.com/Scripts/awa.js" id="AimbaseAnalytics" data-clientId="your client id here"></script>
    
                    
  2. Set Up Your Lead Form Pages
    If you are IFraming in an Aimbase form, the UserUid and SessionUid need to be added to the query string of the IFrame src. The UserUid and SessionUid can be retrieved from the Aimbase.Analytics Javascript API by adding Javascript to the head after the AimbaseAnalytics script. Here's an example of how to do that:
                        
    <script type="text/javascript">
        var iframe = document.getElementById('pageFrame');
        var src = iframe.src;
        iframe.src = 'about:blank';
        var userUid = Aimbase.Analytics.GetUserUid();
        var sessionUid = Aimbase.Analytics.GetSessionUid();
        src += '?UserUid=' + userUid + '&SessionUid=' + sessionUid;
        var source = Aimbase.Analytics.GetFieldValue('source');
        if(source) {
            src += '&LeadSourceName=' + source;
        }
        var campaign = Aimbase.Analytics.GetFieldValue('campaign');
        if(campaign) {
            src += '&LeadCampaignName=' + campaign;
        }
        iframe.src = src;
    </script>
                        
                    
    If you are not IFraming in an Aimbase form, the UserUid and SessionUid need to be sent to the Aimbase lead API along with the rest of your post data.

    Your lead forms should also be set up to inspect the session for an overriding Lead Source, Lead Campaign, or Event. In the case that the source, campaign, or event parameters have a value, these values should be used instead of the form's default values for the LeadSourceName, LeadCampaignName and EventName when posting to the Aimbase Lead API.

    Here is an example of retrieving the source, campaign, and event parameters from the session:

                        
    <script type="text/javascript">
        var source = Aimbase.Analytics.GetFieldValue('source');
        if(source) {
            //override the LeadSourceName value in the Aimbase Lead API post with this value
        }
        var campaign = Aimbase.Analytics.GetFieldValue('campaign');
        if(campaign) {
            //override the LeadCampaignName value in the Aimbase Lead API post with this value
        }
        var event = Aimbase.Analytics.GetFieldValue('event');
        if(event) {
            //override the EventName value in the Aimbase Lead API post with this value
        }
    </script>
                        
                    
  3. Set Up Your Action Tracking
    You can easily set up tracking for various page events to track how your users are using your pages by using the Aimbase.Analytics Javascript API. The Aimbase.Analytics Javascript API contains an AddListener function:
                        
    Aimbase.Analytics.AddListener(
        element, //a DOM element on the page
        name, //a human readable name to identify the DOM element
        action, //the DOM event that should be listened for
        parameters); //(optional) a string or object that contains any additional information to pass to Aimbase when this event is recorded.
                        
                    
    It also contains a RemoveListener function:
                        
    Aimbase.Analytics.RemoveListener(
        element, //a DOM element on the page
        action); //the DOM event that is being listened for
                        
                    
    If the page action has been defined with a score, put the page action's UID in the the optional parameters object. Here's an example of how to use the AddListener function:
                        
    <script type="text/javascript">
        var button = document.getElementById('button');
        var image = document.getElementById('image');
        //report when a user clicks the button
        Aimbase.Analytics.AddListener(button, 'Button', 'click',  { 'PageAction': '02226093-D157-4D35-A358-75D6D3780AC2' }); 
        //report when a user hovers their mouse over the image
        Aimbase.Analytics.AddListener(image, 'Image', 'mouseover'); 
    </script>