The social-media giant’s agreement with state officials removes a cloud that was hanging over its stock, analysts say.