How To Trigger A Popup Modal based on unique URL

Is there a way to trigger a popup modal coming from a specific URL?

for example, traffic coming from a google ads will trigger a different popup from one coming from facebook.

Would that violate googles TOS?