Menu
Menu Sheet Overlay
Search
Search Sheet

Analytics Schema

    Analytics Data Objects are convenient objects with the following functionalities:

    For example, you can create a Page data object as follows:

    const page = new Page({
        [Page.TEMPLATENAME]: 'home'
    })
    
    // Result:
    // page = {
    //     templateName: 'home'
    // }
    

    However, if you provide invalid keys, the invalid keys will not be included in the output.

    const page = new Page({
        [Page.TEMPLATENAME]: 'home',
        someKey: 'some value'
    })
    
    // Result:
    // page = {
    //     templateName: 'home'
    // }
    

    You can set requirements when creating these data objects.

    const page = new Page({
        [Page.TEMPLATENAME]: 'home',
        [Page.TITLE]: 'page title'
    }, [Page.TEMPLATENAME])
    
    // Result:
    // page = {
    //     templateName: 'home',
    //     title: 'page title'
    // }
    
    const page = new Page({
        [Page.TITLE]: 'page title'
    }, [Page.TEMPLATENAME])
    
    // Result: An error will be thrown
    

    You can remap the key names and set default values as well

    const page = new Page({
        [Page.TITLE]: 'page title'
    }, [Page.TEMPLATENAME], {
        [Page.TEMPLATENAME]: {
            name: 'template_name',
            defaultValue: 'none'
        }
    
    })
    
    // Result:
    // page = {
    //     template_name: 'none',
    //     title: 'page title'
    // }
    

    Providing true for keepExtraFields parameter will keep the keys that are not part of the data object definition

    const page = new Page({
        [Page.TITLE]: 'page title',
        'pageStatus': 'login'
    }, [], {}, true)
    
    // Result:
    // page = {
    //     template_name: 'none',
    //     pageStatus: 'login'
    // }
    

    Data Object and available keys