Google Analytics allows to monitor the traffic on each page of a website. It also allows to track the user’s actions on the page.
This article explains how to use the Google Analytics events with the embedded form and the pop-in.
In order to understand this article, you must have a basic understanding of the functioning of Google Analytics. For more information, go to the following page.
A Google Analytics event can be emitted in two ways\:
Via the “browser return” page
At the end of the payment, the embedded form redirects the buyer to the payment confirmation page, also called the “browser return”. This URL is defined via the kr-post-url-success parameter\:
For more information, go to\: Getting started\: single payment.
This page receives (in POST parameters) the newly created transaction. For more details, see the Payment completed page. Using this information, you can emit an event as follows\:
This example emits a new_transaction event in the payment category. The transaction status is also sent.
This example uses our PHP SDK. For more information, go to\: Server SDKs.
Via the form page
In order to retrieve the newly created transaction, you must use the KR.onSubmit event.
Example of code using jQuery\: