SAN FRANCISCO — In July 2013, a broadcaster affiliated with the Islamist group Hezbollah posted a threatening video on Facebook, YouTube and Twitter. It featured gun-toting militants practicing an ambush to kidnap Israeli soldiers. The message: This is how we kill you.

In December, the broadcaster posted another video that showed how Hezbollah’s social media strategy had changed. This one contained close-up footage of Israeli soldiers on patrol, with no Hezbollah members visible. The message was also dialed back: We are watching you.

Hezbollah is among dozens of groups classified by the United States as terrorist entities that have learned how to stay a step ahead of the social media giants. In the past, Facebook, YouTube and Twitter have taken down the official pages of these militant groups dozens of times and banned their accounts.

But Hamas and Hezbollah, in particular, have evolved by getting their supporters to publish images and videos that deliver their message — but that do not set off the alarm bells of the social media platforms. Today, the groups mostly post images of festive parades and religious celebrations online, as well as videos of speeches by their leaders.