I am working on an integration with Rewardful to add an affiliate system to my website. The referral ID is stored in the window object. I know it is not possible to access the window object in page code, but I need to know the referral ID in the page code so that I can append it to my Stripe payment URL so that the affiliate ID is accounted for in Stripe payment.
I was able to add custom HTML code to the body start and I can successfully access the referral ID and log it out. However, I need this in page code so that I can append it to my Stripe URL.
Can someone help me figure out how I can accomplish this. It seems like I need to either:
- Find a way to pass the referral ID from the HTML code in the body to the page code.
- Find a way to assign the Stripe URL to the button from the HTML body code.
- Find a way to access the window in the page code so that I can access the referral ID.
For reference, the following script code successfully logs out the correct referralId when placed in Settings > Custom Code > Body - Start.
Any help would be GREATLY appreciated!