McNamara will be responsible for the website and digital strategy and Tritton will take over the pricing and promotional functions of the job.
Goldberger's departure is the second high-profile exit at Target in less than a month. Chief Marketing Officer Jeff Jones left the company last month and joined Uber Technologies Inc [UBER.UL].
The leadership shake up at Target comes as its rivals gear up to better compete with Amazon. Wal-Mart Stores Inc (WMT.N) last month splashed out over $3 billion to acquire e-commerce startup Jet.com.
Target's online sales contribute about 3 percent to its overall revenue. Recognizing the need to boost growth, the Minneapolis-based retailer spent $1.4 billion in 2015 to improve its e-commerce business.
Target also said it will spend $1.8 billion this year and $2 billion a year starting in 2017 to improve its e-commerce operations.
Target's online revenue grew 31 percent in 2015, below the 40 percent growth Chief Executive Brain Cornell promised investors. For the second quarter, online sales grew 16 percent, a deceleration from 23 percent in the first quarter.
Brick-and-mortar sales have also suffered, with Target reporting its first quarterly drop in comparable sales in two years during the second quarter. The company lowered its forecast for the rest of the year, saying it expects sales to be flat to down 2 percent in the two remaining quarters.
(Reporting by Nandita Bose in Chicago; Editing by Sandra Maler and Alan Crosby)