SAN FRANCISCO — Amid federal investigations into Russian meddling in the U.S. election, Twitter is making all of its ads public, along with who published them and how much was spent, the company said Tuesday.

The move, which follows a similar decision by Facebook, is aimed at adding greater transparency to the largely opaque world of online political advertising. It also may offer some cover for Silicon Valley companies that have come under scrutiny over the role they unwittingly played in allowing a massive Russian disinformation campaign to spread on their platforms.

The social-media companies are facing the possibility of new regulation over political advertising, including the introduction of a bill last week that would require social-media companies to keep public records on election ads and follow the same disclosure rules that are in place for television, radio, and print advertising. Companies would have to make “reasonable efforts” to ensure that election ads are not purchased directly or indirectly by a foreign entity, something already prohibited by law.

“I’m glad Twitter is taking steps to cast light on how exactly advertisers are trying to use their platform to influence elections,” said Rep. Derek Kilmer (D-Wash.), who introduced the bill last week, in an emailed statement. “This proves that increased transparency on online platforms is possible. We need clear rules of the road for all online advertisements which is why I’ll keep pushing to enact our bipartisan bill and protect our democracy.”

In a tweet on Tuesday, Sen. Mark R. Warner (D-Va.) called Twitter’s decision “a good first step.”

But Sen. Amy Klobuchar (D-Minn.), a co-sponsor of the legislation introduced last week, called the Honest Ads Act, said Twitter's “announcement is no substitute for updating our laws.”

“If Twitter is an advocate for this type of transparency and accountability, I look forward to its support of my bipartisan legislation,” said Klobuchar.

Some analysts noted that Twitter’s move may be less significant than Facebook’s because Twitter’s advertising business is much smaller and because Twitter’s ads were largely public to begin with.

Critics of Twitter’s role in the election say that Russian-backed Twitter accounts — rather than individual ads — were a much bigger problem. Such accounts — which generated or spread content that was aimed at influencing the election and dividing American society — were unwittingly shared or retweeted by celebrities and political figures with millions of followers, such as pop star Nicki Minaj and former Trump adviser Michael Flynn.

Those analysts said that the reach of tweets from Russian-backed accounts would have been far greater than the reach of ads. Twitter has declined to share data on the reach of those tweets.

Facebook has also limited its disclosures and transparency efforts to advertising, and has declined to share the reach of content that was posted by Russian operatives who tried to disguise themselves online as legitimate Facebook users and groups supporting the causes of Texas secessionists or Black Lives Matter.

Twitter’s revenue last quarter was $574 million, compared with more than $9 billion for Facebook. Facebook has 210 million U.S. Users logging in monthly, while Twitter has fewer than 70 million. But Twitter’s reach is amplified by the many public figures and news organizations that use the service.

Twitter said Tuesday that it would create an “advertising transparency center” that would display all ads that followed the Federal Election Commission’s definition of an “electioneering ad,” which refer specifically to a candidate or to a party associated with a candidate. Twitter said it would not disclose so-called issue-based ads, which do not mention a candidate, because there was no industry standard for what constituted an issue ad.

The company plans to publish the names of groups that bought the ads and the amounts spent on them. The disclosure policy will apply both to ads put out by an advertisers’ Twitter account, and also so-called “dark ads” — or ads that Twitter’s software directs at specific groups of users but are not shared on an advertiser's main account.

Twitter will also share limited targeting criteria used by advertisers, including the age, gender and location of the users that the ads were directed at. The company does not plan to share the political leanings of Twitter users who were targeted.