?
Solved

Gravity Forms  submission tracking.

Posted on 2016-10-11
3
Medium Priority
?
96 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:Jon Imms
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Jon Imms
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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

777 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