Creating Google Analytics event on page load for order confirmation — send to different GA account

Highlighted
New Member
1 0 0

Alright, this is a bit convoluted but bear with me. 

I have GA integrated with my online store using the Shopify/GA integration. Great! 

I'd like to create a GA event that fires whenever a user completes a checkout — my idea was to add this event to the confirmation page by placing it in Settings -> Checkout -> Order Processing -> Additional Scripts. 

Furthermore, I'd like to send that event to a GA account that is different than the one I have integrated with my Shopify store. (Why? So I can run a Google Optimize test on my personal website, which is attached to GA account #2, and set a purchase on my Shopify store as the objective). 

Here's what I have in that Settings -> Checkout -> Order Processing -> Additional Scripts field (where UA-XXXXX-Y is populated with the account ID for my GA account #2): 

<script>
    ga('UA-XXXXX-Y.send', 'event', 'Store', 'PageLoad', 'Confirmation', '{{ total_price | money_without_currency }}');
</script>

Will this work? I'm waiting for a purchase as a test but I have a hunch I've done something wrong. If my setup will not work, how can I make this happen?

0 Likes