I spray random stuff close to the grass (borders) but not on it, like human urine, vinegar, citronella oil, etc. No dog or cat issues. They won't pee if they smell something they don't like. Need to keep repeating it though as heavy rains will mute the scents.
I also make a habit of talking to the dog owners when I'm outside, just a hello to let them know I'm a grass nut and keep your dog clear. The majority are cool and strike up a conversation. The minority get the stare and keep moving along
Chilli powder irritates them but I haven't tried it as the above works for me.