<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Analytics code in Confirmation message</title>
		<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message</link>
		<description>Gravity Support Forums Topic: Analytics code in Confirmation message</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 10:42:05 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/analytics-code-in-confirmation-message" rel="self" type="application/rss+xml" />

		<item>
			<title>pixelcellar on "Analytics code in Confirmation message"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message#post-33534</link>
			<pubDate>Thu, 25 Aug 2011 08:55:30 +0000</pubDate>
			<dc:creator>pixelcellar</dc:creator>
			<guid isPermaLink="false">33534@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I've been looking at this as needed to get GA click tracking sorted and have a solution after finding the issues mentioned by Enrise above with FrankAnthony's method firing twice. Turns out using the jQuery method hooking off of the gform_confirmation_loaded function has problems too as whilst it'll fire jQuery code and execute it, it reports errors loading jQuery anyway, something it's already done. Use Firebug to see what I mean and wrap either of the suggested functions above with a simple bit of jQuery as follows:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;[js]
jQuery(&#38;#39;#gforms_confirmation_message&#38;#39;).css(&#38;#39;background-color&#38;#39;,&#38;#39;red&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;So anyway, the solution, albeit a minor hack is to use normal JS but to prevent it being called twice. This is done by wrapping the GA code in an IF statement to check for the existence of jQuery which has the desired effect of only running once and not erroring and causing the GA code to fail. Any thought on other work rounds would be appreciated, wish this sort of tracking could be implemented in the core code though :)&#60;/p&#62;
&#60;p&#62;Code for those that might want to get this working though is as follows:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;[js]
&#38;lt;script&#38;gt;

if (typeof jQuery != &#38;#39;undefined&#38;#39;) {

var _gaq = _gaq &#124;&#124; [];
  _gaq.push([&#38;#39;_setAccount&#38;#39;, &#38;#39;UA-XXXXXXX-X&#38;#39;]);
  _gaq.push([&#38;#39;_setDomainName&#38;#39;, &#38;#39;none&#38;#39;]); // Not needed if cross domain tracking not required
  _gaq.push([&#38;#39;_setAllowLinker&#38;#39;, &#38;#39;none&#38;#39;]); // Not needed if cross domain tracking not required
  _gaq.push([&#38;#39;_trackPageview&#38;#39;, &#38;#39;/conversion&#38;#39;]);

  (function() {
    var ga = document.createElement(&#38;#39;script&#38;#39;); ga.type = &#38;#39;text/javascript&#38;#39;; ga.async = true;
    ga.src = (&#38;#39;https:&#38;#39; == document.location.protocol ? &#38;#39;https://ssl&#38;#39; : &#38;#39;http://www&#38;#39;) + &#38;#39;.google-analytics.com/ga.js&#38;#39;;
    var s = document.getElementsByTagName(&#38;#39;script&#38;#39;)[0]; s.parentNode.insertBefore(ga, s);
})();

}
&#38;lt;/script&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>webpuzzlemaster on "Analytics code in Confirmation message"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message#post-30216</link>
			<pubDate>Sun, 17 Jul 2011 14:40:23 +0000</pubDate>
			<dc:creator>webpuzzlemaster</dc:creator>
			<guid isPermaLink="false">30216@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;@david can you give a more specific sample
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Analytics code in Confirmation message"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message#post-24938</link>
			<pubDate>Fri, 06 May 2011 13:40:16 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">24938@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Enrise,&#60;/p&#62;
&#60;p&#62;I would recommend putting Frank's code inside a function that is bound to the &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_confirmation_loaded&#34; rel=&#34;nofollow&#34;&#62;gform_confirmation_loaded&#60;/a&#62; event. This even is fired when the confirmation page is displayed when submitted from an AJAX enabled event.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>enrise on "Analytics code in Confirmation message"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message#post-24908</link>
			<pubDate>Fri, 06 May 2011 05:11:43 +0000</pubDate>
			<dc:creator>enrise</dc:creator>
			<guid isPermaLink="false">24908@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I used FrankAnthony method with ajax.&#60;br /&#62;
But for some reason the script is triggered twice, I confirmed this with a 'console.log()'.&#60;br /&#62;
Any idea how this works?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Analytics code in Confirmation message"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message#post-24084</link>
			<pubDate>Mon, 25 Apr 2011 11:51:45 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">24084@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;@frankanthony That is only the case if your form uses AJAX. AJAX does use an iframe, if you turn off AJAX it does not.  So something to keep in mind.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>FrankAnthony on "Analytics code in Confirmation message"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message#post-24079</link>
			<pubDate>Mon, 25 Apr 2011 11:43:30 +0000</pubDate>
			<dc:creator>FrankAnthony</dc:creator>
			<guid isPermaLink="false">24079@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;The confirmation message loads in an iframe so you have to include the entire code or you will get a javascript error _gaq is not defined.&#60;/p&#62;
&#60;p&#62;The solution is to paste everything into the confirmation text field.  If you put it all on one line in a text editor you don't have to worry about the line breaks.   Copy and paste this, then change 'UA-01234567-1' and '/my-form/sent' &#60;/p&#62;
&#60;p&#62;&#38;lt;script type=&#34;text/javascript&#34;&#38;gt;var _gaq = _gaq &#124;&#124; []; _gaq.push(['_setAccount', 'UA-01234567-1']); _gaq.push(['_trackPageview', '/my-form/sent']);   (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); &#38;lt;/script&#38;gt;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Analytics code in Confirmation message"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message#post-20755</link>
			<pubDate>Thu, 17 Mar 2011 11:30:20 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">20755@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;None, not unless another plugin is causing a conflict.  We don't strip code out of the Confirmation Text field and we haven't had other users reporting this specific issue.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rochow on "Analytics code in Confirmation message"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message#post-20732</link>
			<pubDate>Thu, 17 Mar 2011 01:37:02 +0000</pubDate>
			<dc:creator>rochow</dc:creator>
			<guid isPermaLink="false">20732@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;ok great will wait for monday!&#60;/p&#62;
&#60;p&#62;Yeah the thing is its not being formatted but stripped all together it seems.&#60;/p&#62;
&#60;p&#62;Whe i inspect the element with firebut or google chroms i see the confirmation text but no sign of the javascript at all.&#60;/p&#62;
&#60;p&#62;Any reason you can think of for this?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Analytics code in Confirmation message"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message#post-20682</link>
			<pubDate>Wed, 16 Mar 2011 11:55:58 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">20682@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;It shouldn't be getting stripped out, however Javascript may get disrupted in the Confirmation Text field because it automatically formats text entered.  This can cause problems when entering HTML because it will add BR tags for line breaks, etc. automatically.&#60;/p&#62;
&#60;p&#62;The final release of Gravity Forms v1.5 will have an option to disable the auto-formatting on the confirmation text.  Once that is released as a final release (tentatively scheduled for Monday) you can see if that resolves this issue by selecting that option.&#60;/p&#62;
&#60;p&#62;If you need to implement this now you would have to use a custom confirmation page that you create and then set your Confirmation settings to redirect to that page and embed that script on that page.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rochow on "Analytics code in Confirmation message"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/analytics-code-in-confirmation-message#post-20651</link>
			<pubDate>Tue, 15 Mar 2011 21:15:43 +0000</pubDate>
			<dc:creator>rochow</dc:creator>
			<guid isPermaLink="false">20651@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hey,&#60;/p&#62;
&#60;p&#62;On the advice of others in the forum - I have added google analytics virtual page view code to the confirmation message for an AJAX based form.&#60;/p&#62;
&#60;p&#62;The code ive included is&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;script type=&#38;quot;text/javascript&#38;quot;&#38;gt;
_gaq.push([&#38;#39;_trackPageview&#38;#39;, &#38;#39;/disaster-help/complete&#38;#39;]);
&#38;lt;/script&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;however when i submit the form and view source - i don't see the code in the source - its as though its being stripped out. (other HTML codes like strong are not stripped from the actual confirmation message)&#60;/p&#62;
&#60;p&#62;Does anybody know why?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
