As spending slows, platforms are turning to algorithms to protect margins and reshape competition.