Super Simple Formstack for Salesforce Google Analytics Tracking

Formstack for Salesforce

Formstack is a great little online form solution that integrates nicely with Salesforce. When you’re managing your inbound CRM via Salesforce, you can use Formstack to build native Salesforce forms on your website that will feed submissions directly into Salesforce. What we want here is an additional piece of the equation, connecting that form submission to our Google Analytics data.

The Problem:

Because the Formstack form itself is embedded on the webpage via JavaScript, things can get overcomplicated in a hurry. In typical UpBuild fashion, we’ve rigged up some quick instructions for how to implement Google Analytics event and conversion tracking on the Formstack integration for Salesforce via Google Tag Manager.

The Solution:

There are two key pieces of this implementation. The first will be done by simply pasting some JavaScript within the Form Settings section of Salesforce and the second will be, you guessed it, by deploying a tag via Google Tag Manager.

Part 1: Salesforce & Formstack

Hop into an individual form via the Formstack app and click “Edit”

Open up “Form Settings”

Scroll down to “Javascript Code”

This section is always a lovely addition and enabler for applying more tracking and something that I use more and more frequently across CRM solutions!

Add in a dataLayer push in the Javascript Code section that looks something like this (Fill in your form’s name under “form:”) All this code does is let Formstack know that when a form is submitted, it should push an event called “formSubmission” to the dataLayer, along with the name of the form.

function FF_OnAfterSave() {
dataLayer.push({
event: “formSubmission”,
form: “{Name of Form}”
});
}

Here’s an example of what it might look like:

Go ahead and save that, and let’s continue to step 2.

Step 2: Google Tag Manager

Move on over to your Google Tag Manager Workspace, and let’s get a tag set up that will connect the dots once the Formstack form is submitted and our ‘formSubmission’ event is pushed to the data layer.

Create a new Custom Event Trigger called ‘formSubmission’:

Create a new GTM Tag using the following settings:

Tag Type: Google Analytics: Universal Analytics
Track Type: Event
Category: Form Submission
Action: {{Page Path}}

Set this tag to fire on the formSubmission Trigger that we set up in the previous step.

That tag should end up looking something like this:

Test it out

Submit the form on your site and test it out in GTM preview mode and in your unfiltered Google Analytics View in the Realtime Report.

A formSubmission event should be triggered, and our Lead Form Submission tag should be fired once a form is successfully submitted. Preview Mode should look like this:

As tools and platforms like this remove more and more control over what you can and can’t do with your data, there’s almost always a workaround to connect what you need. Sometimes it just takes a little bit of JavaScript, GTM, and know-how to get it all humming along.

Written by
A strategic leader on the UpBuild team, Laura’s career includes 10+ years of agency experience working on everything from SEO and the semantic web to analytics and CRO.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *