Answer by taking a quote from the following article:

Anyanka "Anya" Christina Emanuella Jenkins is a fictional character created by Joss Whedon for the television series Buffy the Vampire Slayer. She also appears in the comic book series based on the television show. Portrayed by Emma Caulfield, the character appears as a guest star in the third and fourth seasons of the show before becoming a series regular in the show's fifth, sixth, and seventh seasons.

Anyanka arrives at Sunnydale High in 1998 (in the episode "The Wish") as a student named Anya Emerson. She's come to Sunnydale in response to the distress of Cordelia, who is upset after catching her boyfriend, Xander Harris, kissing their friend Willow. After some prompting, Cordelia states: "I wish that Buffy Summers had never come to Sunnydale." Anya shows her true demon face to Cordelia and says, "Done." and the world changes. Now they're in an alternative reality in which Buffy has not come to Sunnydale and the vampire population has multiplied and gained in power. Giles meets with Cordelia before she dies and manages to discern what has happened. He subsequently summons Anyanka and destroys her necklace. As a result, Anya is made mortal again and the world returns to normal.  Caulfield said, "As far as I know, I don't think Joss Whedon ever intended to have Anya around for more than one episode." However, Anya returns in the episode "Doppelgangland", duping Willow into assisting in a failed magical attempt to recover the necklace which was her power center, lost when Giles destroyed it to reverse the wish granted for Cordelia. When these efforts fail, she is forced to continue living as a typical high school student. Now with human feelings, she yearns to attend the school prom in spite of her abhorrence of all men; ironically, her only hope for a date is the last man she was sent to punish, Xander. Caulfield says, "[Whedon] found this great way to have her interact with the storylines that had developed throughout the entire [third] season."  Anya develops feelings for Xander and asks him out again just before graduation. Her romantic plans are foiled when he tells her of the Mayor's plan for his own "Ascension", a transformation into pure demon, at the graduation ceremony. Anya decides to flee Sunnydale and invites Xander to join her, saying when she thinks something could happen to him, she "feels bad inside, like [she] might vomit". Xander refuses because he's got "friends on the line", and can't abandon them. She leaves without him.  Anya returns to Sunnydale early in Season Four, still infatuated with Xander. She seduces him (in the episode "The Harsh Light of Day"). Her lack of experience with people causes her to make straightforward, often tactless remarks, which soon put her at odds with other Scooby Gang members, especially Willow, who has little trust for the ex-demon. Anya's tactlessness is played both for humor and to highlight the truth in situations where others are reluctant to be frank. This is seen most poignantly in "The Body" when her inability to comprehend Buffy's mother's death leads to inappropriate remarks which at first make others angry, but then allow for catharsis and comfort.

What did she do on the show?
Anya's tactlessness is played both for humor and to highlight the truth in situations where