Sum on distinct and group by
You need to group by a substring of source:

SELECT shop_id, 
       substring(source,1,3), 
       COUNT(DISTINCT user_id) AS user_count
FROM tickets
WHERE shop_id = 2
GROUP BY shop_id, substring(source,1,3);


http://rextester.com/EFZZSG27212