The best place to be against this creature is beside or behind it. All its attacks save one require you to be in front of it, and even though it'll make a very quick turn towards you, you still have plenty of time to get out of the way. It can either lunge forward, which hurts, or it can release a torrent of electricity (it'll need to charge for that, giving you early warning). The electrical barrage causes darkness and has a pretty good blast radius. Finally, it can fire poisonous goop into the sky, ideally to have it land on you. The shadows on the ground tip you off as to where they'll land.
At the beginning, you'll only be able to target its head. After you deal enough damage (around 500), it'll break apart into four pieces: the head, the tail, and two midsections. One piece will land in each corner of the battlefield, and the second phase of the battle begins. The four pieces will spin around, going from corner to corner faster and faster, until, after four moves, they each attack in turn, charging you. The head will cause poison if it hits you, and the tail darkness. At this point, it is imperative that you kill at least one segment immediately (ideally one of the midsections, they're the weakest) to give you a place to hide when they start attacking. After they all launch their attack, they'll jump up and shuffle themselves in an effort to throw you off.