I have checked and found that module-google-analytics
is responsible for sending order analytics to Google.
It has events.xml
at magento2Root/vendor/magento/module-google-analytics/etc/frontend
with following content.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="checkout_onepage_controller_success_action">
<observer name="googleanalytics_order_success" instance="Magento\GoogleAnalytics\Observer\SetGoogleAnalyticsOnOrderSuccessPageViewObserver" />
</event>
<event name="multishipping_checkout_controller_success_action">
<observer name="googleanalytics_order_success" instance="Magento\GoogleAnalytics\Observer\SetGoogleAnalyticsOnOrderSuccessPageViewObserver" />
</event>
</config>
So, it is calling observer on order success but only for front-end.
If you move this file form frontend
to global, it will work for admin as well!
So new location for events.xml
will be:
magento2Root/vendor/magento/module-google-analytics/etc/events.xml
Note:
If above observer not work, you can also use checkout_submit_all_after
, OR sales_order_place_after
.
I have not tested above code due to unavailability of key.
If worked, do proper override in custom module.