[% USE Whostmgr; USE NVData; SET is_sandbox = Whostmgr.is_sandbox(); SET server_info = Whostmgr.get_server_info(); SET main_server_ip = ""; IF server_info; main_server_ip = server_info.mainserverip; END; SET is_root_user = CPANEL.authuser == 'root'; # Initialize consent privacy variables to empty. This will help later in the code # to decide whether the values came from NVData or not. SET analytics_for_current_user = ""; SET personhood_for_current_user = ""; SET analytics_NVData = NVData.get('analytics', undef, 0, 'whm'); SET personhood_NVData = NVData.get('personhood', undef, 0, 'whm'); SET slideout_dismissed_nvdata_key = "slideoutDismissed"; SET slideout_dismissed_NVData = NVData.get(slideout_dismissed_nvdata_key, undef, 0, 'whm'); SET analytics_for_current_user = analytics_NVData IF analytics_NVData; SET personhood_for_current_user = personhood_NVData IF personhood_NVData; SET is_slideout_dismissed_for_current_user = 0; SET is_slideout_dismissed_for_current_user = slideout_dismissed_NVData IF slideout_dismissed_NVData; # This default value is prefixed with TT_ to differentiate it from the 'UNKNOWN' # value that can be returned by the Verify plugin. DEFAULT current_license_kind = 'TT_UNKNOWN'; TRY; # The Verify plugin may not be available on all servers depending on the # status of backports and the USE statement will throw an exception. USE Verify; SET is_trial_license = Verify.is_trial(); CATCH; # Verify is not available, fall back to the Old Way SET is_trial_license = Whostmgr.has_license_flag('trial'); SET current_license_kind = 'TT_VERIFY_PLUGIN_MISSING'; END; IF is_trial_license && is_root_user; # If we are using a trial license and this is the root user, we want the # analytics property to be opt-out instead of opt-in. To do this we # interpret no value set as `on` for this condition only. IF analytics_for_current_user == ''; analytics_for_current_user = 'on'; END; END; DEFAULT license_updated = 0; TRY; IF Verify && is_root_user && analytics_for_current_user == 'on'; SET current_license_kind = Verify.lookup_license_kind(Verify.current_license_status) || 'TT_VERIFY_PLUGIN_NO_RESULT'; IF Verify.has_license_changed; SET license_updated = 1; # we have finally handled the event so clear the event flag Verify.clear_license_changed_event(); END; END; CATCH; SET current_license_kind = 'TT_VERIFY_PLUGIN_EXCEPTION'; END; DEFAULT sample_rate = 50; # 50% sampling DEFAULT ga_uid = 'UA-117050492-1'; # PRODUCTION ANALYTICS ACCOUNT IF is_sandbox; SET sample_rate = 100; # 100% sampling SET ga_uid = 'UA-117050492-2'; # DEVELOPER ANALYTICS ACCOUNT END; IF is_trial_license; SET sample_rate = 100; # 100% sampling END; SET base_path = '/var/cpanel/customizations/whm/includes'; # For expired product license, the user is directed to /usr/local/cpanel/base/unprotected/lisc/licenseerror_whm.tmpl # which shows remedies for expired license. This page is not suitable to the UI components of the optin/optout, but # we do want to register GA events on this page if the user has already enabled GA reporting or if the user is root # and is on a trial license. DEFAULT license_expired_page = 0; # NOTE: Check if analytics are disabled server side in WHM. SET is_analytics_enabled_server_side = 0; IF CPANEL.analytics_ui_includes_are_enabled() && CPANEL.ENV.DNT.substr(0, 1) != '1'; is_analytics_enabled_server_side = 1; END; %] [% IF is_analytics_enabled_server_side && template_exists( "${base_path}/slideout.js" ) && !license_expired_page -%]