ユーザーごとに最も早い「imp」が必要なようです。次に、その時点以降のトランザクションごとに集計できます。
SELECT dl.appid, SUM(dl.type = 'click') / SUM(dl.type = 'imp')
FROM dialoglog dl LEFT JOIN
(SELECT dl2.userId, MIN(ds) as imp_ds
FROM dialoglog dl2
WHERE type = 'imp'
GROUP BY dl2.userid
) dlimp
ON dl.userid = dlimp.userid
WHERE dl.ds >= dlimp.imp_ds
GROUP BY dl.appid;