Facebook collected user information to target young users based on emotional state. bykst/Pixabay

Internal documents from Facebook obtained by the Australian appear to show executives at the company monitoring the content of posts and comments to discern the mood of users—information which could then be provided to advertisers.

According to the report, Facebook can track if a user is feeling "defeated," "overwhelmed," "stressed," "anxious," "stupid," "nervous," "silly," "useless" and a "failure."

Read: Facebook Tracking Cancer Sites For Advertising Purposes, Lawsuit Alleges

That emotional data could be combined with Facebook’s other methods of targeting users—including relationship status, location, age and other interests—to serve up advertisements to users who are feeling vulnerable.

Facebook apparently displayed particular interest into how teenagers were acting on the site, as the company was developing covert tools to better gather information that would provide insight into their emotional state.

The documentation shows Facebook intended to target users as young as 14 who “need a confidence boost.”

Facebook has issued an apology for the practice, telling Sky News in Australia that it was wrong to target young children in such a way. The company also said it intended to carry out an investigation into the practices.

Despite the admission of wrongdoing in targeting young users, Facebook didn’t make an apology for targeting users based on their emotional state. The company holds that the research was in line with its privacy guidelines and legal protections.

Read: Facebook Stops Race-Based Marketing For Some Ads

While Facebook may have apologized for its practices, the company may have violated the law in Australia. According to Sky News, the social networking company may have breached the Australian Code for Advertising and Marketing to Children guidelines.

The law, passed in 2014, is designed to “ensure that advertisers and marketers develop and maintain a high sense of social responsibility in advertising and marketing to children in Australia.” It provides a number of guidelines on how companies can and cannot present products to children 14 years old or younger.

This is not the first time Facebook has come under fire for its potentially invasive and morally dubious practices for serving up targeted advertisements.

A class action lawsuit filed against Facebook last year alleged the social network used tracking data and search queries from a number of medical websites to target users based on medical conditions.

The company also came under fire from lawmakers and civil rights organizations for allowing race-based targeted advertisements —a practice that Facebook has since taken action to end.

Users can check to see how Facebook identifies them and how advertisers target them by opening their settings menu on Facebook and going to the “general” tab. Clicking the “Ads” tab on the right-hand sidebar will take the user to a page that displays interests, information and categories Facebook has associated with them.

From the “general” page in the settings menu, users can also download a copy of all Facebook data associated with them by clicking “Download a copy of your Facebook data.”