Support » Plugin: Pronamic Pay » Gravity Forms: measure purchases with Google Analytics

  • Resolved Carsten


    I’ve a Gravity Form connected with Pronamic Pay so my site visitors can make purchases. I want to measure this purchases. I want to do this with Google Analytics 4 (GA4) ecommerce features using Google Tag Manager on my website.

    After a purchase is completed I want to send the purchase event with the data layer.

    Is there a hook for this that contains the currency and purchase value?

    • This topic was modified 4 months, 1 week ago by Carsten.
    • This topic was modified 4 months, 1 week ago by Carsten.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Reüel van der Steege


    To be able to use payment details in a script, you need to add the ID of the payment to the redirect URL and add some code to add a tracking script in which you can then include the order details based on the given payment ID.

    To get this working, make sure to set set the status page to a Gravity Forms confirmation:

    • WordPress admin » Forms » [ Select form ] » Settings » Pay » [ Select payment feed ] » Tab ‘Status pages’

    In the selected confirmation (form settings » Confirmations), set the type to ‘Redirect’. Enter the URL of your ‘Thank You’ page and add the following query string parameter: gf_payment_id={pronamic_payment_id}

    Now, in for example the functions.php of your theme, add the following code to add a custom tracking script in which you can include the payment details:

    add_action( 'wp_footer', 'payment_details_script', 10 );
    function payment_details_script() {
    	// Check for payment ID.
    	if ( ! \filter_has_var( \INPUT_GET, 'gf_payment_id' ) ) {
    	$payment_id = \filter_input( \INPUT_GET, 'gf_payment_id', \FILTER_SANITIZE_NUMBER_INT );
    	$payment = \get_pronamic_payment( $payment_id );
    	// Check valid payment.
    	if ( null === $payment ) {
    		var pronamicPayAmountCurrency = "%s";
    		var pronamicPayAmountValue = "%s";
    		// Your tracking code...

    Please note that if you also want to add other payment details in the script, the payment ID in the URL can easily be changed to another ID by any user. Make sure to not disclose personally identifiable information from the payment this way.

    Thread Starter Carsten


    Thank you. It is a good advice to keep the personally identifiable information in mind.

    Thread Starter Carsten


    When I setup the query string parameter gf_payment_id={pronamic_payment_id} the page redirects (after the payment) to ?gf_payment_id=%7Bpronamic_payment_id%7D.

    I’m using Buckaroo as payment provider (in test mode). Is the ID not set because of the test mode?

    Plugin Author Remco Tolsma


    I just tested it with the following setup:

    Gravity Forms Confirmation Settings

    Redirect result:

    Redirect Address

    Are you on the latest version of Gravity Forms and Pronamic Pay? Maybe a Gravity Forms Add-On is causing an issue?

    Thread Starter Carsten


    It is solved and it works. I have set the redirect URL in form settings » Pay instead of form settings » Confirmations.

    • This reply was modified 2 months, 3 weeks ago by Carsten.
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.