Accessing $FPROM and Window

I am trying to integrate code to post onClick to First Promoter. I am using this.

export function button2_click(event)
{
$w.$FPROM.trackSignup({
email:$w(‘#input2’).value
}, function (){console.log(‘Callback received!’)});

}

It giving me an error saying: cannot read property tracksignup of undefined.

Can anyone help? I need to access the window object that contains FPROM.

You don’t have access to the DOM in Corvid/Wix in general. What kind of signup are you attempting to track?

Thank you. This has been infuriating. We are trying to track a lead into First Promoter.

We use this code on Head

And then this on a JS Event, button click.

$FPROM.trackSignup({
email:,
function(){console.log(‘Callback received!’)});

Is there a workout around for this? Any help appreciated.

You can see at https://www.kylar.ai/contact

console.js:35 TypeError: Cannot read property ‘trackSignup’ of undefined
at button2_click (k9ffr.js:5)
at Object.e. (userCodeHandler.js:78)
at Object.t.onMessage (postMessage.es6:262)
at InternalAPIs.value (internalAPIs.es6:141)
at delegateMessageToSDK (worker.js:180)
at worker.js:172
at Object.handle (queueUntilAllPrevIsProcessed.js:33)
at self.onmessage (worker.js:66)

Is the error in Developer Tools

@matthew26 You should probably contact their support to see if they have a specific Wix integration procedure. If they don’t or if you already tried this, then you will need a backend module using their tracking API .

FP have been great, but they have never had a WIX customer before it seems.

@skmedia Last question David. Does WIX Developer allow you access cookies? If not, then we are stuffed, otherwise it’s a winner.

@matthew26 Cookies are set and retrieved using the wix-storage API:
https://www.wix.com/corvid/reference/wix-storage.Storage.html

@skmedia Great, so I could do this right? I can get the tracking ID which is stored in the cookie?

Thanks!

https://docs.firstpromoter.com/#tracking-api

The recommended way to do this is to grab the _fprom_track cookie value(which keeps the tracking id and referral identification) on your server and send it along with the sign-up data through the tid parameter.

Alternative : In some special cases, you can refer sign ups directly to a promoter, by passing the referral id through ref_id parameter. Be careful using this because the referral id can be modified by the promoter by default, however you can disable that from the campaign configuration page.

@matthew26 I’m honestly not sure about the first one, it would take some testing and more reading through their docs. The second sounds very straightforward, so almost certainly yes.