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 body section of the page, before the closing </body> tag.
                    
    <script type="text/javascript" src="https://wsqa.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, event, medium, term and content 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
        }
    
                    var medium = Aimbase.Analytics.GetFieldValue('medium');
        if(medium) {
                    //override the Medium value in the Aimbase Lead API post with this value
        }
    
                    var term = Aimbase.Analytics.GetFieldValue('term');
        if(term) {
                    //override the Term value in the Aimbase Lead API post with this value
        }
    
                    var content = Aimbase.Analytics.GetFieldValue('content');
        if(content) {
                    //override the Content 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.
    type, //(optional) a human readable name to identify the type of event being recorded
    category //(optional) a human readable name to identify the category of event being recorded
    ); 
    
    //existing aimbase data like page category, lead type, and product information can be tied to these events via the parameters field.
    //(note: product requires a valid code, year, brand and manufacturer combination)
    //example json:
    //{
    //  "products": [
    //        {
    //            "code": "123",
    //            "name": "name1",
    //            "modelYear": 2017,
    //            "brandCode": "productBrand",
    //            "manufacturerCode": "productManufacturer"
    //        },
    //        {
    //            "code": "124",
    //            "name": "name2",
    //            "modelYear": 2017,
    //            "brandCode": "productBrand",
    //            "manufacturerCode": "productManufacturer"
    //        }
    //    ],
    //    "productTypes": [
    //        "productType1",
    //        "productType2"
    //    ],
    //    "leadForm": {
    //        "leadType": "Request Quote"
    //    },
    //    "pageCategory": "Lead Form"
    //}
    
                    
    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>
                        
                    
  4. Get User Product and Segment Details
    Using this method you can easily get user product and segement details by Aimbase.Analytics Javascript API.Here's an example of how to use the GetUserProductSegmentDetails method:
                    
    <script type="text/javascript">
       Aimbase.Analytics.GetUserProductSegmentDetails(function (responseData){
                    // response data contains product and segment details
                    example response data:
                    {
                    "ProductTypeCode": "Boat",
                    "ProductCode": "180 Sportsman",
                    "ProductName": "180 Sportsman",
                    "ProductModelYear": 1998,
                    "ProductCategory": "17ft - 18ft 11in",
                    "BrandCode": "Brandcode",
                    "SegmentName": "SegmentName"
                    }
                          
        });
    </script>
                        
                    
  5. Capture Structured Data

    The Aimbase Capture API in the web session tracking script also allows you to send additional data points about the user that is browsing your website. These data points are then used in aggregate to report on the types of users that are browsing your website and their interests.

    The SendProfile function is used to capture profile data about your user, including their name and address.

                    
    <script type="text/javascript">
        Aimbase.Capture.SendProfile(
            firstName: string,
            lastName: string,
            email: string,
            countryCode: string,
            postalCode: string,
            address1: string,
            address2: string,
            city: string,
            state: string,
            homePhone: string,
            mobilePhone: string,
            workPhone: string,
            textOptIn: boolean,
            emailOptIn: boolean
        );
    </script>
                        
                    

    The SendDealer function is used to capture information about the dealer your user is interested in.

                    
    <script type="text/javascript">
        Aimbase.Capture.SendDealer(
            dealerNumber: string,
            dealerLocation: string,
            manufacturerCode: string
        );
    </script>
                        
                    

    The SendProduct function is used to capture information about the product your user is interested in.

                    
    <script type="text/javascript">
        Aimbase.Capture.SendProduct(
            code: string,
            name: string,
            modelYear: string,
            brandCode: string,
            manufacturerCode: string
        );
    </script>
                        
                    

    The SendProductType function is used to capture information about the product type your user is interested in.

                    
    <script type="text/javascript">
        Aimbase.Capture.SendProductType(
            name: string
        );
    </script>
                        
                    

    The SendSegment function is used to capture information about the segment your user is interested in.

                    
    <script type="text/javascript">
        Aimbase.Capture.SendSegment(
            name: string
        );
    </script>
                        
                    

    The SendCampaign function is used to capture information about the campaign your user is interested in.

                    
    <script type="text/javascript">
        Aimbase.Capture.SendCampaign(
            name: string
        );
    </script>
                        
                    

    The SendLeadForm function is used to capture information about the type of lead form your user is browsing.

                    
    <script type="text/javascript">
        Aimbase.Capture.SendLeadForm(
            leadType: string
        );
    </script>
                        
                    

    The SendPageCategory function is used to capture information about the web page category your user is browsing.

                    
    <script type="text/javascript">
        Aimbase.Capture.SendPageCategory(
            code: string
        );
    </script>
                        
                    

    The SendTag function is used to tag the user's browsing with any value. These values can be used for filtering reports.

                    
    <script type="text/javascript">
        Aimbase.Capture.SendTag(
            name: string,
            value: string
        );
    </script>
                        
                    

    The SendIdentifier function is used to associate the current WebUser to an identifer that is used to link the web activity to the same user's activity. It can also be used to link the current WebUser to an Aimbase prospect. Examples of identifiers include an email address or a website store user ID. Note: if the session has an existing identifer set and then a new identifer is set, the existing web session will be expired and a new web user and web session will be created.

                    
    <script type="text/javascript">
        Aimbase.Capture.SendIdentifier(
            id: string,
            type: string
        );
    </script>
                        
                    

    The Aimbase Capture API also offers a fluent API for chain adding different data points before sending them to the server. Here is the usage and the available functions.

                    
    <script type="text/javascript">
        Aimbase.Capture.Start()
            .AddProfile(firstName, lastName, email, countryCode, postalCode, address1, address2, city, state, homePhone, mobilePhone, workPhone, textOptIn, emailOptIn)
            .AddDealer(dealerNumber, dealerLocation, manufacturerCode)
            .AddProduct(code, name, modelYear, brandCode, manufacturerCode)
            .AddProductType(name)
            .AddSegment(name)
            .AddCampaign(name)
            .AddLeadForm(leadType)
            .AddPageCategory(code)
            .AddTag(name, value)
            .AddIdentifier(id, type)
            .Send();
    </script>
                        
                    

    For example, if there is a page that should be attributed to a certain segment and then tagged with two additional data points. The fluent API usage would look like this.

                    
    <script type="text/javascript">
        Aimbase.Capture.Start()
            .AddSegment('segment1')
            .AddTag('tag1', 'value1')
            .AddTag('tag2', 'value2')
            .Send();
    </script>
                        
                    
  6. Set User Uid
    Using this method you can easily set the user for the proceeding session. This creates a new session and page visit, then sending this data to the client install. Here's an example of how to use the SetUserUid method:
                    
    <script type="text/javascript">
        Aimbase.Analytics.SetUserUid('a5b3d56a-6e82-497e-a2a7-a62415833c1c');
    </script>
                        
                    
  7. Manually Send Page Visits
    When a page is loaded, a Page visit is automatically sent. However, in some cases, like when tracking analytics on a single page application, it can be helpful to manually send a page visit when the page changes. To do this, you can use the SendPageVisit method. Here's an example of how to use it:
                    
    <script type="text/javascript">
        // Aimbase.Analytics.SendPageVisit(url, title, callback);
        // if url or title are not provided, the current url and title will be used.
        Aimbase.Analytics.SendPageVisit('https://example.com', 'Page Title');
    </script>