TROCCO Web Activity Log Collection SDK - Various Functions
    • PDF

    TROCCO Web Activity Log Collection SDK - Various Functions

    • PDF

    Article summary

    summary

    The TROCCO Web Activity Log Collection SDK allows you to embed additional JavaScript code or run scripts to

    This page explains each method with sample code.

    Add event tracking

    See Adding Custom Columns below for the following Ja value1'}` section.

    Nanalytics('send','event',{category:<category>,action:<action>,label:<label>,value:<value>,sendPageviewIfSessionExpired:(<boolean>)}, {custom_column_1: 'value1'});
    

    The acquired events can be forwarded by selecting Event Log inData Source - TROCCO Web Activity Log.

    Various parameters in the code

    Parameters marked with ✓ in the required columns must be included in the code.

    Parameter Nameindispensabledata typeDescription.
    actionstringTypes of Interaction
    categorystringObjects used for interaction
    label-stringUsed to categorize events
    value-numberFigures related to events
    sendPageviewIfSessionExpired-booleanIf the session has expired when the event fires, whether to renew the session by sending a PageView

    code sample

    Below is a code sample to log user clicks on external site links.
    If you wish to specify the value of a string type parameter, enclose the set value portion in quotation marks.

    <a >https://example.com/</a>
    

    Adding Custom Columns

    Both page view logs and event logs can include any column in the retrieved data by Custom Columns Setting.

    Number of custom columns set

    There is a limit to the number of custom columns that can be set.

    • For page view logs: up to 10 columns
    • For event logs: up to 5 columns

    code sample

    In the following code sample, please edit the column name (the custom_column_x part) and its value accordingly.
    Only string type ( string ) values can be specified.

    For page view logs

    Edit the Nanalytics('send','pageview'); line in the JavaScript code for embedding, as described in Embedding JavaScript Code, as follows

    Nanalytics('send','pageview',{custom_column_1: 'value1', custom_column_2: 'value2'});
    

    For event logging

    Based on the JavaScript code described in Adding Event Tracking.

    <a >https://example.com/</a>
    

    Change existing settings

    You can modify some of the internal settings of the TROCCO Web Activity Log Collection SDK by embedding the following additional JavaScript code.

    Nanalytics('config','<setting_name>',<setting_value>);
    

    List of settings that can be changed

    Default values are usually used for the following settings

    Setting name (setting_name)data typeConfiguration detailsdefault value
    session_expire_msecnumberSession timeout in milliseconds1800000
    cookie_prefixstringCookie key name prefix used by TROCCO Web Activity Log Collection SDK__na_
    cookie_hoststringCookie domain used to store data
    If a domain is prefixed with . at the beginning of a domain, sessions and user IDs are shared among the subdomains under that domain.
    Site host for delivery
    customer_idstringFields for storing site customer IDs, etc.
    Please note that the data type is STRING.
    -

    code sample

    The Nanalytics('setup',...) and Nanalytics(' send ',...) lines of the embedding code, as described in Embedding JavaScript Code. line and Nanalytics('send',...) Add the following line between the Nanalytics('setup',...) and Nanalytics('send',...) lines of the embed code.
    If you want to change the setting value of a string type, enclose the setting value portion in quotation marks.

    
    

    Acquisition of collected data by script execution

    Data collected by the TROCCO Web Activity Log Collection SDK can also be retrieved by executing the following script
    Please use it when you want to check the value with the developer tools of your web browser, etc.

    Nanalytics('get',[<callback_function>]);
    

    List of data that can be retrieved by the script

    The argument of the callback function will be an object with the following property name
    If the value does not exist, it is undefined.

    Property Namedata typeDescription.
    site_idstringSite-specific ID issued by primeNumber
    user_idstring1st party cookie (site domain) based unique ID (generated by UUIDv4)
    session_idstringUnique ID within a session (generated by UUIDv4)
    browser_heightnumberBrowser Height
    browser_widthnumberBrowser Width
    languagestringBrowser Language
    session_numnumberTotal number of sessions for the user in question
    session_start_timenumberSession start date and time
    session_channel_urlstringURL of the incoming flow path at the beginning of the session
    mediumstringValue equivalent to utm_medium in Google Analytics
    sourcestringValue equivalent to utm_source in Google Analytics
    campaignstringValue equivalent to utm_campaign in Google Analytics
    keywordstringValue equivalent to utm_term in Google Analytics
    ad_idstringAd IDs such as Google Ads
    urlstringNormalized and decoded URL
    referer_urlstringNormalized and decoded referrer URL
    customer_idstringCustomer ID
    browser_timenumberDate and time the PageView occurred in the user's browser time
    pv_numnumberCumulative number of PageViews in the relevant session

    code sample

    The following is a code sample that outputs the value of session_num.

    Nanalytics('get',function(value) { console.log(value.session_num) });
    

    Was this article helpful?