Converted if..else to ternary and added method definition in common_analytic.rb