Piwik\Tracker\Request::truncateCustomVariable PHP Method

truncateCustomVariable() public static method

public static truncateCustomVariable ( $input )
    public static function truncateCustomVariable($input)
    {
        return substr(trim($input), 0, CustomVariables::getMaxLengthCustomVariables());
    }

Usage Example

Example #1
0
 public function getCustomVariables()
 {
     $customVariables = parent::getCustomVariables();
     // Enrich Site Search actions with Custom Variables, overwriting existing values
     if (!empty($this->searchCategory)) {
         if (!empty($customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_CATEGORY])) {
             Common::printDebug("WARNING: Overwriting existing Custom Variable  in slot " . self::CVAR_INDEX_SEARCH_CATEGORY . " for this page view");
         }
         $customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_CATEGORY] = self::CVAR_KEY_SEARCH_CATEGORY;
         $customVariables['custom_var_v' . self::CVAR_INDEX_SEARCH_CATEGORY] = Request::truncateCustomVariable($this->searchCategory);
     }
     if ($this->searchCount !== false) {
         if (!empty($customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_COUNT])) {
             Common::printDebug("WARNING: Overwriting existing Custom Variable  in slot " . self::CVAR_INDEX_SEARCH_COUNT . " for this page view");
         }
         $customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_COUNT] = self::CVAR_KEY_SEARCH_COUNT;
         $customVariables['custom_var_v' . self::CVAR_INDEX_SEARCH_COUNT] = (int) $this->searchCount;
     }
     return $customVariables;
 }
All Usage Examples Of Piwik\Tracker\Request::truncateCustomVariable