Hundreds of drivers will get a free device and app that can track everything from gas use to speeding, acceleration, and hard braking through a new city pilot program, officials said Thursday.

The Department of Transportation will give 400 licensed New Yorkers a device that can be used in three tracking programs called Dash, Metropia, and Commute Greener.

It collects a car's data after being installed under the dashboard and uploads them to a smartphone app. It can tell motorists where their car is parked, locate a mechanic, alert authorities if there is a crash, and explain why the "check engine" light is on. It also tells drivers how often they speed, make a hard brake, and accelerate.

"These are behaviors you can improve," said Jaymn Edis, who co-founded the SoHo startup Dash. It is part of the pilot program.

"It can improve your fuel efficiency, we can tell you when you need to change your oil," he said. "People spend $10,000 a year on driving -- most people have no idea what happens under the hood of their car."

Drivers can compete with friends on their social media network to see who is the best driver, and earn badges for fuel and safe driving. The app also shows them what stations nearby have the cheapest gas.

Dash has been compared to Fitbit, a tech wearable that tracks people's steps everyday and creates competitions for friends.

Motorists in the pilot program, called Drive Smart, will also use the app Metropia to avoid traffic jams.

It gives drivers rewards like gift cards to companies like Amazon, Starbucks, Targets, and local New York stores for traveling outside of rush-hour during off-peak hours and picking less popular routes.

Motorists who join the pilot program can get up to a 30 percent discount from Allstate insurance, according to the DOT.

The Commute Greener app is another part of the pilot, rewards New Yorkers when they carpool, bike, or take the subway.

"Drive Smart will leverage private sector innovations to help motorists spend less time stuck in traffic, and save on gas and insurance," siad DOT Commissioner Polly Trottenberg.in a statement.

New Yorkers who want to sign up for the pilot can apply at drivesmartnyc.com.