Detect when projectile lands [1.20.1]

I need to detect and run a function where a snowball/ender pearl lands. I've tried this: /execute as @e[type=ender_pearl,tag=exampletag] at @s unless block ~ ~-1 ~ air run function example:function and it works for landing on a block, but hitting a wall doesnt trigger it. Is there a better way to do this then checking all directions for blocks in seperate commands?

Continue to help post