boomerang::initialize_widget (public)
boomerang::initialize_widget [ -subsite_id subsite_id ] \ [ -version version ]
Defined in packages/boomerang/tcl/boomerang-procs.tcl
Initialize an boomerang widget.
- Switches:
- -subsite_id (optional)
- -version (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set t0 [clock clicks -microseconds] if {$subsite_id eq ""} { set subsite_id [get_relevant_subsite] } set resource_info [resource_info -version $version] set version [dict get $resource_info configuredVersion] set enabled_p [parameter::get -package_id $subsite_id -parameter BoomerangEnabled -default 1] # # When the package is enabled, and we are not in a "bots" # connection pool, look in more details. # if {$enabled_p && [ns_conn pool] ne "bots"} { # # Check, if we should sample this request # set sample [parameter::get -package_id $subsite_id -parameter BoomerangSample -default 1] if {$sample < 1} { set sample 1 } if {[nsv_incr boomerang counter] % $sample == 0} { # # Yes, we can! # # Get the URL and add JavaScript to the page # set beaconURL [parameter::get -package_id $subsite_id -parameter BoomerangBeaconUrl -default /boomerang_handler] set prefix [dict get $resource_info prefix] foreach jsFile [dict get $resource_info jsFiles] { template::head::add_javascript -src ${prefix}/$jsFile } # # One could add additional plugins here, but many are # already included in the provided .min.js file via the # upstream provided plugins.json # # "plugins/auto-xhr.js", # "plugins/spa.js", # "plugins/history.js", # "plugins/rt.js", # "plugins/bw.js", # "plugins/navtiming.js", # "plugins/restiming.js", # "plugins/mobile.js", # "plugins/memory.js", # "plugins/cache-reload.js", # "plugins/md5.js", # "plugins/compression.js", # "plugins/errors.js", # "plugins/third-party-analytics.js", # "plugins/usertiming.js", # "plugins/mq.js" # template::head::add_javascript -src ${prefix}/plugins-$version/navtiming.js #template::head::add_javascript -src ${prefix}/plugins-$version/rt.js template::head::add_javascript -order 2 -script [subst { BOOMR.init({ beacon_url: "$beaconURL", log: null, NavigationTiming: { enabled: true, clearOnBeacon: true } }); }] } } #ns_log notice "boomerang::initialize_widget (enabled $enabled_p)" "[expr {[clock clicks -microseconds] - $t0}] microseconds"XQL Not present: Generic, PostgreSQL, Oracle