Solved

Gravity Forms  submission tracking.

Posted on 2016-10-11
3
68 Views
Last Modified: 2016-10-20
I am trying to add some javascript tracking code to a gravity forms submission.

I would like the following to be added to the submit button :

      <script type="text/javascript">
   window._pq = window._pq || [];
   _pq.push(['track', 'Appcomplete']);
</script>

I know i have to use the gform_after_submission hook below,  but i'm not sure how i would add a javascript script into a php function?

add_action( 'gform_after_submission_1', 'after_submission', 10, 2);
function after_submission() {

}
0
Comment
Question by:jonathan1978
  • 2
3 Comments
 
LVL 25

Expert Comment

by:James Rodgers
ID: 41839996
i think this is more what you are looking for

https://www.gravityhelp.com/documentation/article/gform_post_render/

but the code you provided is not bound to a submit action, it is executed as the page loads, it doesn't need o be bound to a form submit action, just place it on the page in the footer
0
 

Author Comment

by:jonathan1978
ID: 41841058
From what i'm being told,  this is bound when the submit button is clicked.
http://support.perfectaudience.com/knowledgebase/articles/212490-segmenting-api

    <script type="text/javascript">
   window._pq = window._pq || [];
   _pq.push(['track', 'Appcomplete']);
</script>
0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 500 total points
ID: 41841826
from the documentation , something similar to this is what you need

$(document).ready(function() {
  window._pq = window._pq || [];
  $('submitButtonIdentifier').one('click', function() {
    _pq.push(['track',  'Appcomplete');
  }); });

Open in new window


replace 'submitButtonIdentifier' with the id or class of the submit button
ID
'#submitButtonIdentifier'
Class
'.submitButtonIdentifier'
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hbo knew my windows software 4 60
Log in through ID 5 17
HTML Anchor Link Problem 3 35
form validation - make sure at least 1 checkbox is selected 18 26
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The viewer will learn how to dynamically set the form action using jQuery.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question