This question already has an answer here:
Polyjuice Potion recognizes the victim (whose identity is compromised) by using his/her hair or something.
In case of Love Potion, victims actually eat or drink the Love Potion, but how does Love Potion know who the attacker (with whom the victim get infatuated) is?
When Love Potion is brewed, it certainly is neutral without attacker identity. That's why, so many of girls were able to order the Love Potion from Weasleys' Wizard Wheezes. What do girls do to the Love Potion after getting it and before sending it to target boy?