You use the level of the class that gives you the animal companion feature. So in this case, just the Mad Dog levels. Unless you have another source which grants you the animal companion class feature (like Druid) then you stack the levels of the two classes together.