SAN FRANCISCO — Government censorship of the Internet is a cat-and-mouse game. And despite more aggressive tactics in recent months, the cats have been largely frustrated while the mice wriggle away.

But this year, the challenges for Silicon Valley will mount, with Russia and Turkey in particular trying to tighten controls on foreign-based Internet companies. Major American companies like Facebook, Twitter and Google are increasingly being put in the tricky position of figuring out which laws and orders to comply with around the world — and which to ignore or contest.

On Wednesday, Russia’s president, Vladimir V. Putin, signed the latest version of a personal data law that will require companies to store data about Russian users on computers inside the country, where it will be easier for the government to get access to it. With few companies expected to comply with the law, which goes into effect Sept. 1, a confrontation may well erupt.

The clumsiness of current censorship efforts was apparent in mid-December, when Russia’s Internet regulator demanded that Facebook remove a page that was promoting an anti-government rally. After Facebook blocked the page for its 10 million or so Russian users, dozens of copycat pages popped up and the word spread on other social networks like Twitter. That created even more publicity for the planned Jan. 15 event, intended to protest the sentencing of Aleksei A. Navalny, a leading opposition figure.