This entry is part 2 of 2 in the series Google Analytics and Pardot
  1. Google Analytics Connector
  2. Can I track Google Analytics conversions?

You can integrate Google Analytics with your Pardot marketing initiatives. Evaluate the following options on where to place your Google Analytics code to obtain successful tracking. For information on tracking your Google AdWords conversions please see our documentation on Can I track Google AdWords conversions?

Getting Started

Google Analytics conversion tracking requires two elements: Analytics tracking code that runs when your Pardot form is loaded, and a separate conversion code that runs when your Pardot form is completed.

If your Pardot form is located on a Pardot landing page, place your Analytics tracking code within the Pardot landing page via the appropriate layout template or via the landing page builder.

If your Pardot form is iframed onto an external page, place your Analytics tracking code within the form’s layout template.

Your Analytics tracking code is accessible in your Analytics interface via Admin > Tracking Info > Tracking Code.

Analyitics

You’ll want to update ‘UA-xxxxxx-x’ and ‘yourdomain.com’ in the following example with your Analytics account number and your domain name, respectively (Analytics should provide these elements by default when you generate your tracking code). Your tracking code will look something like this:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxx-x']);
_gaq.push(['_setDomainName', 'yourdomain.com']);
_gaq.push(['_trackPageview']);

(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);
})();

</script>

Tracking Code when your Form is on Pardot Landing Page

If the form is hosted on a Pardot landing page you will need to place the above Analytics tracking code onto the landing page — via layout template or form builder, depending on the method of styling you are using for your landing page.

Layout Template

If the landing page is using a layout template place the Analytics tracking code on the landing page’s layout template, just before the %%content%% tag in the layout template:

See the following image for an example of what this code will look like on your layout template:

layout temp ga

Landing Page Builder

If the landing page is using stock templates in the Landing Page Builder, place the Analytics tracking code in a Scripts element within the builder.

  1. Navigate to Marketing > Landing Pages.
  2. Select a landing page to edit.
  3.  In step 4, Landing Page Content, click Page Options at the top right of the editor.
  4. In the pop up window, look for Scripts and click edit. A window will appear where you can add your unique Google Analytics code.
  5. Click Done.

The code placed in the Scripts element will not be visible when the page is displayed.

lp builder ga

Tracking Code when your Form is on an External Page

If the form is hosted on an external page (a page you host) you will need to place the Analytics tracking code within the form’s layout template.

See the following image for an example of what this code will look like, when combined with your Analytics-generated tracking code on your form’s layout template:layout temp ga

Updating your Conversion Code

This will be the code you will place on your Form’s “thank you code” or on the thank you page you redirect to after the form has been submitted.

1. Log into your Google Analytics account and create a new goal (Admin > Goals > New Goal)

  • Goal Name: Goal name will appear in Conversion reports
  • Type: Destination

new goal

  • Destination: Enter the goal URL of your choice. The successful conversion will be recorded once the prospect reaches this page.  For example, you could use a thank you page or registration confirmation page. In some cases, a form may not redirect to a specific page after a submission. In this case, you can enter a placeholder for the goal URL. Be sure to paste your placeholder after ‘_trackPageview’ in the Thank You Code. The corresponding snippet of JavaScript in the Thank You Code tab of the form must match the Destination URL placeholder.
  • Case Sensitive: Leave unchecked
  • Value (optional): Choose the value of your choice
  • Funnel (optional): Choose the expected traffic path of your choice

goal details

2. Create your goal conversion code
Take the following code example, and update your account number and goal

URL:

<script type="text/javascript">
try{
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', 'UA-xxxxxx-x'],
['_trackPageview', '/thankyou']
);
}catch (err) {}
</script>

3. Update the form’s thank you location

Add your goal’s specific conversion code to the Thank You Code area of your Pardot form. The form’s Thank You Code can be found within the Forms Wizard Step 4 – Completion Actions.goal convers ga

If your form redirects to a separate Thank You Page rather than showing the form’s Thank You Code, place your modified Analytics conversion code on the Thank You Page that you redirect to.

Updating your Conversion Code When Using Universal Tracking Analytics Code

If you are using Universal Analytics in your Google Analytics account, your conversion code will look differently than the code example above.

Take the following code example and update ‘UA-xxxxxx-x’ and ‘yourdomain.com’ in the following example with your Analytics account number and your domain name. You’ll also want to update the destination URL to the goal URL you chose in Step 1 of Updating your Conversion Code. In the example below, the destination URL was set to”/thankyou.”

 <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXX-X', 'yourdomain.com'); ga('send', 'pageview', '/thankyou'); </script> 

Google Analytics Source Tracking

Pardot recognizes Google source tags (?utm_source=XYZ) in URLs and will enter that value into your prospect’s source field if that link was his or her first tracked touch. For more information, see How is the Source field populated?.

Not what you’re looking for? Check out these other articles:
Why do my traffic statistics in Pardot differ from my web analytics application?
Can I track Google AdWords conversions?

Series Navigation

<< Google Analytics Connector