I am attempting to ensure that my Google Analytics 4 “purchase” conversion event does not fire more than once by making use of Shopify’s first_time_accessed Liquid variable in the context of the “additional scripts” part of Settings > Checkout for the Order Status Page.
In order to fire the “purchase” event only once, the variable must return “true” only on the first time the customer views the Order Status page. However, by rendering the liquid value (outside of a script tag) as such;
{{ first_time_accessed }}
I have found that the variable does not resolve to either “true” or “false”, it is just blank, which results in missed conversions as the Javascript code does not load for first-time viewers of the Order Status page.
I’ve also tried to console.log the variable by rendering it into the JavaScript code like this;
console.log("first_time_accessed = " + "{{ first_time_accessed }}");
but, as before, the output looks like "first_time_accessed = ".
I have reached out to Shopify Plus Support, as some other Forum posts have received no response from staff, but was turned away with the explanation that Shopify does not support this feature. Shopify documentation implies that this variable can be used for exactly the case I have described, and that it should return “true” or “false”. Is there any hope of a resolution here?