Google Auto-Tagging & Salesforce Pardot Opportunities

Intro

In the age of technology, every company wants to leverage paid ads and marketing automation. It is very common to see Pardot connected to Google Ads, to enhance reporting between the two systems.

The standard Pardot setup, for reporting Ads conversions, is great for most companies. We won’t go into every detail in this post, but it consists of going into your Pardot Account, heading over to Pardot Settings > Connectors > ‘Add Connector’, choosing the Google Ads connector, and logging in to your account.

Once the connector is set up, you can click on the gear icon to the right of the Google Ads Connector and click ‘Tracking’. This will give you a universal snippet that your Ads admin can append to the end of URLs to capture things campaigns, keywords, and other items that Pardot can report on.

The final step, to record conversions, would be to get the conversion snippet from your Google Ads admin and head over to Pardot. Open up your leads form and paste this snippet into the ‘Thank you code’ section of the completion actions.

Now you are set up with Pardot reports for tracking Ads and the conversions report back to Google Ads to help improve its algorithms.

But what if that’s not how your company measures conversions?

That setup is great for most companies, but not every business counts all of their form fills as true conversions. A lot of companies capture and warm up leads in Pardot, but true conversions don’t happen until that lead is converted to a contact with an opportunity, in Salesforce.

This is where we take our Ad tracking in Salesforce and Pardot to the next level. We will work with three assumptions, but this method can be altered to fit your specific needs.

  1. Your Google Ads account has auto-tagging on
  2. Your company counts a true conversion when an opportunity is created (or even won)

Google Ads

While the connector does not play as big of a part in this setup, It is still a highly recommended connector to relate key metrics to prospects in Pardot. While you can’t run actions based on the ads they clicked, you can still see it in their engagement history.

With auto-tagging on your Google Ads admin doesn’t need to adjust the URLs at all. The string will automatically be appended to the URL. Consult your Google Ads admin if you are unsure, sometimes auto-tagging won’t work well with your setup. If this is the case, just create the fields in the next step for the UTM parameters you want.

If you haven’t enabled Pardot connected campaigns already, you are probably still soaking in the possibilities. It can transform the insight you have into marketing initiatives. Not only do you have dashboards to see how your campaigns and their assets are performing, but you can see multiple campaigns that influenced opportunities [1].

Capturing GCLID

Pardot

First you will want to make sure you add your custom GCLID field to Pardot prospects by going to Pardot Settings > Object & Field configuration > Prospect Fields. You will also need to add this field to the leads object in salesforce and map it between the two systems.

For each of your Pardot forms, you will need to add hidden fields with the same names as the parameters.  If you are using UTM parameters and a Pardot landing page, you are finished. However, Pardot cannot capture the GCLID string, so if auto-tagging is on you will need to have a script created.

Add this new field as a hidden field to your forms. You will want to note this field’s ID or let your web developer know that they will need it. On the pages where the forms exist, you will want to consult your web developer and have them build a script that grabs the GCLID parameter and adds it to your hidden field.

Here is an example of a script that accomplishes this, but you have to replace ‘var gclidFormFields’ with your field ID.

<script>

function getParam(p) {

var match = RegExp(‘[?&]’ + p + ‘=([^&]*)’).exec(window.location.search);

return match && decodeURIComponent(match[1].replace(/\+/g, ‘ ‘));

}

function getExpiryRecord(value) {

var expiryPeriod = 90 * 24 * 60 * 60 * 1000; // 90 day expiry in milliseconds

var expiryDate = new Date().getTime() + expiryPeriod;

return {

value: value,

expiryDate: expiryDate

};

}

function addGclid() {

var gclidParam = getParam(‘gclid’);

var gclidFormFields = [‘gclid_field’, ‘foobar’]; // all possible gclid form field ids here

var gclidRecord = null;

var currGclidFormField;

var gclsrcParam = getParam(‘gclsrc’);

var isGclsrcValid = !gclsrcParam || gclsrcParam.indexOf(‘aw’) !== -1;

gclidFormFields.forEach(function (field) {

if (document.getElementById(field)) {

currGclidFormField = document.getElementById(field);

}

});

if (gclidParam && isGclsrcValid) {

gclidRecord = getExpiryRecord(gclidParam);

localStorage.setItem(‘gclid’, JSON.stringify(gclidRecord));

}

var gclid = gclidRecord || JSON.parse(localStorage.getItem(‘gclid’));

var isGclidValid = gclid && new Date().getTime() < gclid.expiryDate;

if (currGclidFormField && isGclidValid) {

currGclidFormField.value = gclid.value;

}

}

window.addEventListener(‘load’, addGclid);

</script>

iFrame

If you grab the standard Pardot form iframe and past it into your page, you will need to pass the GCLID string from the main page, through the iframe so it can be recorded in the field. First you will need to assign and ID to your iFrame, in the HTML. Afterwards, you can place this script on the page itself, adjusting for your ID

<script type=”text/javascript”>

var iframe = document.getElementById(‘myID’);

iframe.src = iframe.src + window.location.search;

</script>

Salesforce

With our Pardot forms capturing GCLID from Google Ads clicks and passing it to Salesforce, the journey is almost complete.

On the Salesforce side, we want to add a new custom field to the opportunity to pass our data to. It can also be named ‘GCLID’ and we just need to map the lead field to the opportunity field. This will allow us to see every opportunity that came from an Ad click. But it gets even better!

Import Conversions from Salesforce Connector

Now that you have all your data in place, head back over to your Google Ads and click the wrench icon in the top right. Go to Measurements > Conversions > Click Salesforce on the left. Connect your salesforce org and continue to set the criteria for what counts as a conversion.

Now you have your leads and opportunities with a GCLID string, for reporting in Salesforce, and Salesforce is sending the proper ones back as conversions to Google Ads for a full circle tracking and reporting in your systems.

Contact Us