There is no single world government with legal power to set laws for everyone on the planet, so this is accomplished via cooperative nation-by-nation laws. The World Intellectual Property Organization administers a number of international treaties, and almost all countries on the planet are members, though when it comes to specific agreements and protocols, coverage can be spottier. One scheme is "The Madrid Union", which both the US and Norway are members of. If I foolishly decide to start marketing dairy products in the US using a bucket with wings as a logo and call my company "Tine", some other company might want to sue me for violation of their trademark. The text of the Trademark Law Treaty is here, and you can see that this is basically about registration, and not remedies. By going through one of these registration-disseminations protocols, they may have registered their trademark in the US, so they could sue me here for infringement.
There isn't anything legally special about ads or being online. If it is prohibited to use a trademark without permission, then it is prohibited to use the trademark online without permission. Permission might be highly restricted (e.g. the Disney trademark), or not (can't think of an example).