Buy button Tracking Consent

Hey Guys,

this is my first question.

If i chose the wrong Location for this question, feel free to teach me.

My situation:
Iam using the Shopify Buy Button on my website. I would like to Track the Shopify statistics (earnings, user calls etc.)
For this type of tracking i need to ask my customer if it is okey for him to track his data.
I can not use a Shopify App, so i watched for any code to do it myself and found this:

window.Shopify.customerPrivacy.setTrackingConsent(true)

(Actually the Cookie banner Shopify Apps all use this function)

With this function i can set the Customer Consent for the tracking question.

The problem:
On my website i cant reach “window.Shopify” this Object does not exist in the Buy Button Template.

Is there any way to access this Object with Buy Button only?