PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Google Analytics E-commerce tracking codes for gravity forms

  1. I’ve been trying to utilize the e-commerce functionality of Google Analytics for my website. I built several websites with different gravity forms in several pages of my website. These gravity forms have different fields or not identical with each other. I would like e-commerce of Google Analytics to extract data from the form fields and reflect those data on e-commerce reports. And I also want to assign values for every successful submission of the forms.

    In trying to do this, I come across with the problem of modifying the tracking codes generated by Google Analytics. I need to modify these codes so gravity forms and e-commerce can work together.

    I found a resource containing modified codes for the forms and e-commerce to work together: http://cutroni.com/blog/2008/07/02/google-analytics-e-commerce-tracking-pt-4-tacking-lead-gen-forms/. The form he used is created using javascript and HTML and the form is for ecommerce transaction.

    But I want codes for GRAVITY forms that contain:

    Name:
    Email:
    Telephone:
    Address:
    Subject with drop down options: Other, Send Information, Contact, Outlets

    Does anyone knows or have ideas on how to modify these codes do that Gravity forms and e-commerce can work together?

    Posted 8 years ago on Wednesday November 10, 2010 | Permalink
  2. andrew carbn
    Member

    I would love to know too!

    I don't understand why people are not tracking payments made through Gravity Forms.

    I know GF were never supposed to replace an ecommerce system... but tracking the purchase amount is extremely important.

    Has anybody got any experiance or know where to begin with this?

    Cheers! :)

    Posted 7 years ago on Friday December 9, 2011 | Permalink
  3. Hi Andrew,

    This is a good idea and is feasible now with some custom code. A good place to start on the Google Analytics side of things is here:

    http://code.google.com/apis/analytics/docs/tracking/gaTrackingEcommerce.html

    As far as the Gravity Forms side of things... this will depend on if you're using PayPal or not. If so, it gets a little trickier. You'll need to decide if you want to track all orders or only orders that were completed successfully (aka paid).

    Assuming you want to track paid orders, you can use the gform_paypal_fullfillment hook to integrate with the GA functionality to capture these leads.

    If you decide to tackle this, let me know if you have any questions along the way. :)

    Posted 7 years ago on Friday December 9, 2011 | Permalink
  4. andrew carbn
    Member

    Me again! :)

    I do have questions now...

    I have been trying to get this working but still stuck and my brain wont come up with any more ideas to try.

    I'm using paypal.
    I only want to track paid successfull orders.

    So lets say I wanted to use the gform_paypal_fullfillment hook like you have suggested:

    Do I paste the code: add_filter("gform_paypal_fulfillment", "process_order", 10, 4); to the top line of paypal.php

    Where does GA come into place? I assume it needs an 'order complete' page after being redirected from PayPal to see the data to track in ecommerce?

    Sorry for this, I am good at making a guess, but here it just seems like witchcraft :)

    Posted 7 years ago on Tuesday January 10, 2012 | Permalink
  5. Do I paste the code: add_filter("gform_paypal_fulfillment", "process_order", 10, 4); to the top line of paypal.php

    No, that code goes into your theme's functions.php file.

    And I think you are correct about needing an "order complete" page to track successful completion of the transaction. I would use that vs using a text confirmation.

    This is not witchcraft, but it might be voodoo.

    Posted 7 years ago on Wednesday January 11, 2012 | Permalink
  6. So I've been struggling with this as well. I decided to tie into the gform_confirmation hook instead of gform_paypal_fulfillment hook since gform_confirmation actually deals with the what's showing up in the browser instead of what's going on in the back end (since analytics is javascript based).

    Anyway, here's the gist of what I do:

    1. Check to see if the submitted form has a 'product field'...if it does, I assume it's an e-Commerce transaction
    2. I generate the _gaq javacript code to place on the page (see http://code.google.com/apis/analytics/docs/tracking/gaTrackingEcommerce.html)
    3. If the confirmation is text, I append it to the bottom of the text
    4. If the confirmation is a redirect, I send the _gaq javascript, plus I send a window.location='{page/to/redirect/to}' to send the browser to the new page

    It's not exactly robust and I haven't tested it extensively, but if anyone has any feedback as to improvements on this, I would appreciate it.

    https://gist.github.com/1962059

    Posted 7 years ago on Friday March 2, 2012 | Permalink
  7. Has anyone been able to find a clear solution for this issue? jloosli's solution looks like it probably works, but is also very complicated from my perspective (not much experience with the custom PHP/JS solution he provided.)

    The difficulty I'm having is that I understand that the GA E-commerce script needs a receipt of some kind. Which seems pretty straightforward. However, I'm not sure if this can be done on a separate redirect page. Can it? If so, is there documentation anywhere?

    For example, my form redirects to a 'Thank You' page separate from the payment form. That page just includes text. Is it very easy to include the 'receipt' there? That way I can include the GA script and thank you text in the same location.

    Any help or insight here is greatly appreciated!

    Posted 7 years ago on Monday June 25, 2012 | Permalink
  8. boldison
    Member

    Hi David,

    I am trying to do exactly what you suggest. about using that hook.

    How would I go about getting all the info I need into that function and telling Google of the transaction using their Javascript example?

    Kind regards,

    Nick

    Posted 6 years ago on Thursday August 23, 2012 | Permalink
  9. Paper Tower
    Member

    I'd love a solution for this as well!

    Posted 6 years ago on Wednesday October 3, 2012 | Permalink
  10. boldison
    Member

    Not sure it's going to happen. A few other limitations/bugs using GF too, so we're in the process of moving away...if that helps.

    Posted 6 years ago on Wednesday October 3, 2012 | Permalink
  11. @bolsidon, I have not seen a lot of support requests in the forum from you. Because you have a developer's license, maybe you're using priority support? In any event, if you having trouble with bugs or limitations, please feel free to post them in the forums and we will help you where we can.

    Posted 6 years ago on Wednesday October 3, 2012 | Permalink

This topic has been resolved and has been closed to new replies.