The Original FileMaker Community
Business Templates - Demo Apps - Video Tutorials -Samples - Help - 46000 Member Forum

The Leading Filemaker Developer Tools

Integrating Google AdWords with Salesforce and Pardot

If you use Pardot to handle your marketing campaigns and have tried to integrate your Google AdWords to your Salesforce org, you have probably noticed that Google does not provide any step-by-step solutions on how to integrate all three of them together to track your clickable ads. It took some time, but after some coding changes and a rather long phone call with Google, there is a solution that can now be followed to solve this.

If you are using a native Salesforce web-to-lead form, then you can find standard support here from Google. If you use Pardot for your landing pages, continue reading below to get some help integrating Google AdWords and Salesforce through Pardot.

Setting Up Your Files

Create new GCLID Fields

To start off, let’s create new GCLID fields on both the opportunity and lead objects. See Figures 1 and 2 below.

Add the GCID field to the Oportunity

Figure 1. Add the GCID field to the Opportunity

Expand image

Add tje GCID field to the Lead

Figure 2. Add the GCID field to the Lead

Expand image

After the two fields have been created on the opportunity and lead objects, we must map the fields, as shown in Figures 3 and 4.

Figure 3 for the "Integrate Google AdWords with Your Salesforce Org Through Pardot

Figure 3. Begin to map the lead fields.

Expand image

Figure 4. Mapping the Lead and GCID fields

Figure 4. Mapping the Lead and GCID fields

Expand image

Add the script to your landing pages

Now that the configurations have been completed, it’s time to touch some code on your website. If you don’t have access to this, contact your webmaster to help with this step. A cookie value needs to be stored on your website to save the GCLID based on the ad that is clicked on. The following script should be added before your tags on all of your landing pages on the website.

<script type="text/javascript">
    function setCookie(name, value, days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
        document.cookie = name + "=" + value + expires + ";domain=" + location.hostname.replace("www.", '');
    function getParam(p) {
        var match = RegExp('[?&]' + p + '=([^&]*)').exec(;
        return match && decodeURIComponent(match[1].replace(/+/g, ' '));
    var gclid = getParam('gclid');
    if (gclid) {
        var gclsrc = getParam('gclsrc');
        if (!gclsrc || gclsrc.indexOf('aw') !== -1) {
            setCookie('gclid', gclid, 90);

Create a hidden field

Once this step is completed, we will now focus on the Pardot portion of the integration. To start off, on your landing pages, create a hidden field labeled GCLID.

Figure 5. Create a hidden GCID field

Figure 5

Expand image

Add code snippet to your form

Next, on the same form, click on “Look and Feel” on the menu bar towards the top of the page. You will see a “Below Form” tab which should be clicked on. When clicked, all the way to the right you will see an html button (next to the omega symbol) click that.

Figure 6. Add code snippet to your form.

Figure 6

Expand image

  window.onload = function getGclid() {
    document.getElementById("xxxx").value = (name = new RegExp('(?:^|;s*)gclid=([^;]*)').exec(document.cookie)) ? name.split(",")[1] : ""; }   
  var putGCLID = function() {
    document.getElementById("xxxx").value = (name = new RegExp('(?:^|;s*)gclid=([^;]*)').exec(document.cookie)) ? name.split(",")[1] : "";
  document.getElementById('pardot-form').addEventListener("submit", putGCLID, true);

The “xxxx” in the document.getElementById is the id of the GCLID field on your form and the “pardot-form” is the id of the entire form.” Can view the id by right-clicking on the form area, clicking “Inspect” and finding the code for the GCLID field and copying it’s id. Repeat for the form area also.

After this piece of code is inserted into the Pardot form, you are now ready to test the integration between Salesforce and Google AdWords through Pardot. In the URL of your contact us page, add “?gclid=blogTest” (or any testing word) at the end as shown below.

Find the information submitted

Once you submit the lead information, in Salesforce, go to Leads and find the information that you submitted (see Figure 7).

Figure 7. Find the information you submitted

Figure 7

Keyword added to the GCLID field

In the GCLID field, you should see the keyword that you entered at the end of the URL in the step above, in my case being “blogTest” as shown in Figure 8.

Figure 8. Keyword added to the GCLID field

Figure 8

When the link is successful — meaning you see the keyword “blogTest” that you entered into the URL in your lead in Salesforce — then you have now integrated Google AdWords with Salesforce through Pardot! The final step, is to link your Salesforce account to your Google AdWords account.

Link Your Salesforce and Google AdWords Accounts

Sign in to your Google AdWords account and on the right hand side next to your customer id, you will see a cog. When you click on the cog, there should be a link called “Linked accounts.”

Figure 9. Click on the cog to access "Linked accounts"

Figure 9

Choose accounts to link to Google AdWords

After you have clicked the Linked accounts link, you should be on the following page. Here you can choose which accounts to link to your Google AdWords account. In our case, click on “View details” under

Figure 10. Choose an account to link to Google AdWords

Figure 10

Expand image

Log into your Salesforce organization

Finally, click on the “+ Account” button on the page and you will be redirected to the Salesforce authentication page to login to your Salesforce organization.

Figure 11. Use the add account button.

Figure 11

Expand image

Once your Salesforce organization is linked, you will be prompted to set up conversions that are relevant to your Google ads. After you set up these conversions, you are now ready to completely track your clickable ads with AdWords and Salesforce through Pardot.

On this site we promote, share and showcase material from Soliant Consulting one of the BEST consulting company’s in FileMaker.

We encourage you to visit their site and to inquire about their services. FMT is proud to deliver and promote FileMaker for Small Business Owners Worldwide since 1997. Our Forum The Original FileMaker Forum has 45,700+ members.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy