Sending a transaction using Daemon Collector This article describes the principles of transferring transactions using the Daemon Collector technology. false W3sidGl0bGUiOiJJbnRlZ3JhdGlvbiIsInVybCI6Ii91c2Vycy9pbnRlZ3JhdGlvbi8ifSx7InRpdGxlIjoiQW5hbHl0aWNhbCBzZXJ2aWNlcyIsInVybCI6Ii91c2Vycy9pbnRlZ3JhdGlvbi9hbmFseXRpY2FsLXNlcnZpY2VzLyJ9LHsidGl0bGUiOiJJbnRlZ3JhdGlvbiB3aXRoIEdvb2dsZSBBbmFseXRpY3MgKEdBNCkiLCJ1cmwiOiIvdXNlcnMvaW50ZWdyYXRpb24vYW5hbHl0aWNhbC1zZXJ2aWNlcy9pbnRlZ3JhdGlvbi13aXRoLWdvb2dsZS1hbmFseXRpY3MvIn1d Integration /users/integration/ ["users","Integration"] ["users","Integration","Analytical services"] users

Sending a transaction using Daemon Collector

This article describes the principles of transferring transactions using the Daemon Collector technology.

If you need to send a transaction on a site that uses the daemon collector to place orders in RetailCRM, then, to form a transaction, you need to add the specific function (for sending a transaction from Google Analytics) inside the successful transaction delivery condition in the daemon collector form.

Via analytics.js

<script type="text/javascript">
$(function() {
 $('#feedback-form').submit(function() {
 _rc('send', 'order', {
 'name': $(this).find('input[name=name]').val(),
 'email': $(this).find('input[name=email]').val(),
 'customTransactionId': url('?transaction_id'),
 'orderMethod': 'feedback',
 'callback': function(success, response) {
 if (success) {
 ga('ecommerce:addTransaction', {
 'id': response.id, // Transaction ID
 'affiliation': 'example.com', // Store name
 'revenue': '1500', // Total cost of the order
 'shipping': '250', // Delivery cost
 'tax': '' // Налог
 });
 ga('e commerce:send'); // Sending data
 alert('Thank you, your request is accepted! Its number: ' + response.id);
 } else {
 alert ('Unfortunately, the request could not be sent.');
 }
 }
 });
 return false;
 })
})
</script>

Via gtag.js

<script type="text/javascript">
$(function() {
 $('#feedback-form').submit(function() {
 _rc('send', 'order', {
 'name': $(this).find('input[name=name]').val(),
 'email': $(this).find('input[name=email]').val(),
 'customTransactionId': url('?transaction_id'),
 'orderMethod': 'landing-page',
 'callback': function(success, response) {
 if (success) {
 gtag('event', 'purchase', {
 "transaction_id": response.id,
 "dimension1": getRetailCrmCookie("_ga"),
 "affiliation": "Google online store",
 "value": 23.07,
 "currency": "USD",
 "tax": 1.24,
 "shipping": 0,
 });
 } else {
 alert('Unfortunately, the request could not be sent.');
 }
 }
 });
 return false;
 });
 });
</script>

Note

response.id is the external identifier of the order (externalId) in the system. When integrating, in the settings of the Google Analytics module, in the “Link transactions/events via” parameter, you must select the value “Order ID in the store”.
Thank you for your feedback.
Was this article helpful?
No
  • The recommendations did not help
  • There is no answer to my question
  • The text is difficult to understand
  • I do not like the described functionality
Yes
Previous article
Specifics of configuring an integration between Universal Analytics and InSales
This article describes the specifics of adding a tracking code to InSales CMS.