I think you could use wix-storage for this. See documentation here .
What I’m thinking is that you put “on click” handlers on your buttons, which would put a string into storage (probably session storage for this case), identifying which page/location the user is coming from, before sending the user to the contact page:
import { session } from 'wix-storage';
import wixLocation from 'wix-location';
export function learnMore_click(event) {
session.setItem("contactSubjectLine", "Whatever you want subject line to be");
wixLocation.to("/contact");
}
Then, on your contact page, in the onReady function you can load the string from storage to see where the user came from, and use this to pre-load the subject line as appropriate:
import { session } from 'wix-storage';
$w.onReady(function () {
let subjectLine = session.getItem("contactSubjectLine");
let subjectField = $w("#subjectFieldId");
subjectField.value = subjectLine;
});