Those pesky ads that show up in Internet searches might have a new use — to deliver public health messages that aim to prevent cancer, a new study suggests.

In the study, researchers used the online advertising service Google Ads to create advertisements aimed at preventing skin cancer linked to indoor tanning. The ads contained warnings about the harms of tanning beds, and directed people who clicked on them to information from the Centers for Disease Control and Prevention. These ads appeared in the search results when people searched for "tanning beds" or related words, from April 2014 through March 2015.

During the study, there were about 75,000 Google searches per month, on average, for "tanning," "tanning bed" and "tanning salon," with a spike in searches occurring in April and May, the researchers said.

The advertisements were viewed more than 235,000 times, and were clicked more than 2,000 times. This 1 percent "click-through rate" is considered adequate for commercial advertisements, the researchers said. [5 Things You Must Know About Skin Cancer]

"Google handles 3-and-[a]-half billion searches a day," study co-author Dr. Eleni Linos, an assistant professor of dermatology at the University of California, San Francisco, said in a statement. "This is an incredible opportunity for targeted, cost-effective public health messages. Even beyond skin cancer, our approach could be used for other major public health issues, such as tobacco control or mental health problems."

The ad that got the most clicks said, "The Truth of Tanning Beds/Do you know what you are doing to your skin? Educate yourself!" It was clicked on by 2,062 visitors, according to the study.

The ads that performed the worst were those that focused on appearance, the researchers said. For example, an ad that said "Tanning Makes You Ugly" was clicked on just 25 times.

The researchers noted that they could not determine whether their ads changed anyone's behavior and that more research is needed to look at this question.

But the findings do suggest that researchers could partner with technology or social media companies to use online advertising to improve public health, Linos said. "We need to figure out how to best reach large audiences and deliver messages that are relevant and meaningful to them," Linos said, "and the ultimate question is how these interventions will actually shift behaviors."

The ads for the study were provided for free by Google for Nonprofits, a program in which the technology giant gives nonprofit groups technical tools, including free or discounted ads and apps.

The study is published online today (Oct. 7) in the journal JAMA Dermatology.

Copyright 2015 LiveScience, a Purch company. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.