The answer might be "both." Fornication or sexual immorality, according to Barnes' Notes on the Bible is associated with the cult of Balaam:
And to commit fornication - Balaam taught this; and that was the
tendency of the doctrines inculcated at Pergamos. On what pretence
this was done is not said; but it is clear that the church had
regarded this in a lenient manner. So accustomed had the pagan world
been to this vice, that many who had been converted from idolatry
might be disposed to look on it with less severity than we do now, and
there was a necessity of incessant watchfulness lest the members of
the church should fall into it.
Strong's Greek Lexicon even goes as far as stating that the infinitive πορνεῦω means to
(literally) indulge unlawful lust (of either sex), or (figuratively) practise idolatry:--commit (fornication)
Looking at other uses of the word throughout the Bible it appears that general consensus is that this particular word largely refers to sexual immorality, but the context and intended function of the pericope in question should certainly help to determine whether the author meant sexual immorality, idolatry, or perhaps both.
In the context of Rev 2:15 it would seem that the surface meaning is about idolatry. Balaam is mentioned a handful of times throughout the OT and is usually giving prophetic advice which will turn Israel away from God (Num 31:16; Deut 23:4-5; Josh 24:9-10. C. Savelle points out several early writers had a fascination with Balaam and his standing with Yahweh, ranging from villain to wayward prophet meaning no harm. Whatever Balaam's intentions, the general consensus is that Balaam was not in good standing with Yahweh. Savelle makes the argument that Balaam in the NT is the prototype of the false prophet. He connects the references to Balaam in 2 Peter and Jude to Revelations, saying that most of these authors pointed at Balaam as a symbol for their contemporary opposition. This would heavily argue for a non-sexual interpretation.
However, it's not impossible that the teachings of Balak and Balaam would call for what might have been considered sexual immoralities. And as Barnes' Notes would suggest, Balaam's teaching is no exception. I haven't found any other support for this view, but it is worth consideration. It would certainly seem that the word πορνεῦσαι is fairly apt in its use here to indicate the idolatrous teachings of Balaam as well as the sexual immorality of those teachings if they were indeed so.
To the question of linking this to Jeremiah 3:20 - I would suggest that, unlike the word πορνεῦw, the Jewish word בָּגְדָ֥ה(treachery) does not have the same inherent sexual meaning. If the author of Jeremiah wished to connote sexual immorality the terms (adultery)נִאֻפִים and (harlotry)זְנוּת seem to be Jeremiah's preference and it appears the text is by and large purely focused on the idolatry of Israel.
Savelle, Charles H. 2009. "Canonical and extracanonical portraits of Balaam." Bibliotheca Sacra 166, no. 664: 387-404.