Hartley was born in Dumbarton, Scotland and was the son of a tailor. After youth football with Artizan Thistle, he joined Dumbarton, where two of his brothers also played, in 1890. During his time with Dumbarton, he converted from a right back to a forward. While on the books of Dumbarton, the team won the first two Scottish Football League titles in 1891 and 1892 together with the 1891 Scottish Cup. However Hartley was not a regular with the club at this stage.
Everton
He moved south of the border to join Everton in December 1892, making his debut on 18 March when, playing at inside right, he scored in a 4–2 victory at Wolverhampton Wanderers. That was his only appearance in the 1892–93 season in which Everton finished third in the table. The following season, he made six league appearances, scoring twice, following this up with five goals from 11 appearances in the 1894–95 season when Everton finished as runners-up behind Sunderland. During this season he remained third–choice striker behind England internationals, Fred Geary and Jack Southworth. Following Southworth's retirement through injury and Geary's move to Liverpool, Hartley played more regularly although the arrival of Scotland internationalJohn Cameron prevented Hartley from claiming the centre-forward's berth as his own. In the 1895–96 season he made 15 appearances, scoring seven goals as Everton finished in third place followed by 14 appearances with six goals in the following season. In 1897 Everton reached the FA Cup Final with victories en route over Burton Wanderers, Bury, Blackburn Rovers and Derby County. Hartley played in all five matches in the cup run, scoring against Blackburn and Derby. In the final Everton came up against Aston Villa who were dominating the Football League season. Although Everton took the lead after 28 minutes with goals from Jack Bell and Dickie Boyle, they were unable to prevent Villa claiming the Double with a 3–2 victory. In the following season, he only made three appearances before moving across Stanley Park to join Liverpool in December. In his five years at Everton, Hartley made 61 appearances, scoring 28 goals; his appearances were restricted due to the quality of forwards on Everton's books such as Geary, Southworth and Cameron as well as other internationals Alf Milward, Edgar Chadwick and Jack Bell.
Liverpool
Hartley stayed at Liverpool for the remainder of the 1897–98 season. During his time with the club he scored the winning goal in a 2–1 away win at Sheffield United on 29 December 1897. Altogether Hartley was capped a sum of 12 times for Liverpool, scoring once. By now, Hartley was a member of the Association Footballers' Union which was trying to improve player's wages and contract terms. To improve his wages, Hartley decided to join Southampton.
Southampton
Being members of the Southern League, Southampton were not bound by the restrictions imposed on Football League clubs and were quite willing to pay higher salaries for talented players. Southampton had just moved into their new stadium at The Dell and had signed England internationals Arthur Chadwick, Jack Robinson and Harry Wood as well as Scotland's Jacky Robertson. Hartley was ever-present until injury forced him to sit out the last three matches of the 1898–99 season as Southampton claimed the Southern League title for the third consecutive year. Hartley's 14 league and two FA Cup goals made him joint top scorer for the season. Hartley would place a hand-rolled cigarette behind his ear prior to kick-off and then smoke it in the changing room at half-time before re-taking the field.
Arsenal and Burnley
Hartley moved to Woolwich Arsenal in July 1899 where he scored once in five appearances. He made his debut away to Walsall on 23 September 1899 and scored his only goal in a 2–1 win over Gainsborough Trinity on 14 October. However that same month Arsenal signed Ralph Gaudie from Sheffield United, who forced Hartley out of the side. Hartley was sold in December, moving back to Lancashire to join Burnley where he brought an end to his playing days. His five goals from thirteen appearances were unable to prevent Burnley being relegated to the Second Division at the end of that season.
Later career
After retiring from football in 1900, Hartley returned to live in Southampton. He took up employment with the London and South Western Railway but collapsed and died outside the pay office in Southampton Docks on 9 October 1909, aged only 37. A doctor at the inquest attributed his death to "syncope, arising from double pneumonia".