Read the German's accounts of losses to bomber guns. They kept great records for most of the war and knew which planes attacked which bomber type as formations were mostly of a single type and they deduced that holes in the front came from bomber guns and in the back from fighter guns.
That is how we know that B-17s shot down more EA than any fighter plane type. ( EA = Enemy Aircraft!) Aunt Viola asked, so I thought I better make that clear?
I wonder how they counted those holes in shot down aircraft ?
You do realize a high percentage of them are going to be nothing but smoking holes in the ground don't you ?