How To Add Sales to Google Analytics Reports

Adding sales is the single best improvement that can be done to Google Analytics reports. It helps to report revenue each of the marketing channel produces in a familiar user interface.

This guide explains how to set up a server-to-server integration for Google Analytics e-commerce transactions. While Google Analytics / GTag JS has ability to send online transactions, this isn’t adequate for many businesses’ needs.

Server-to-server integration allows to report sales that can’t be captured in browser: closed CRM deals, revenue from subscriptions when payments are successfully processed, online sales that can’t be tracked by GA code alone because they may happen across multiple devices or use browser with ad blocking plugin.

Google Analytics provides a so-called ‘measurement protocol’, which allows to send all of these sales to the system as e-commerce transactions.

Google Analytics Setup

The first step is to locate the Google Analytics tracking id for the property you’d like to use for reporting.

Open Google Analytics, Admin – Property Settings page. Tracking Id should be the first item on the list. Record it.

Formsable Setup

The easiest way to attribute purchases to Google Analytics user ids is to use Formsable app, which does it automatically.

After completing general Formsable setup, open ‘API Credentials’ tab. Select ‘Google Analytics’ service and enter Tracking Id in the Access Token field. Leave Refresh Token blank and enter arbitrary name you’d like to use as a reference (for example, corresponding Google Analytics property name). Press ‘Save’.

Open ‘Outbound’ tab. Select the Google Analytics Credential you’ve just saved and ‘Purchase’ event type. Press ‘Save’.

At this point required integration setup is complete and Formsable will start sending all purchases it attributed to Google Analytics visitors to Google Analytics Measurement API. They’ll appear in the Conversions – E-commerce reports. The e-commerce conversions can also be set up to be displayed in standard Google Analytics reports such as Acquisition Report:

How To Send CRM Purchases to Google Ads

Sending conversions to Google Ads is an extremely common integration scenario. Its used to add conversion value to Google Ads’ reports, allowing to report on ROI, as well as to use performance-based targeting and optimisation capabilities.

This guide will focus on using server-to-server API integration to send conversions to Google Ads API. There are two main reasons to prefer server-to-server integration to pure browser JavaScript tracking code:

  1. Even when purchases happen online completely, its not uncommon to see 15-25% of sales that come from ads to remain unattributed to the campaigns. This happens because of users using multiple devices, ad blocking plugins and general lack of reliability of client-side tracking.
  2. Often, purchases happen offline: for example, when a sale is closed in CRM or when a first payment for subscription is successfully taken by a payment service provider such as Stripe.

Google Ads Setup

The first step to start using a server-to-server integration is to configure Google Ads. The ‘Set up offline conversion tracking‘ guide in Google Ads Help covers two necessary steps to begin: enabling auto-tagging and setting up a Conversion Action – a hint telling Google Ads how to process your conversions.

(Google refers to all conversions that aren’t tracked by its JS tracking code as ‘offline’. They may not actually happen offline, such as in a store, and would more often be a result of online user activity.)

Once Google Ads setup is complete, conversions are ready to be sent to Google Ads. While it can be done with a direct Google Ads API integration, rest of this guide will assume you’re using Formsable to track CRM sales and attribute them to ad clicks.

Formsable Setup

In the Formsable UI, open ‘API Credentials’ tab and press ‘Connect Google Ads’ button. It will grant Formsable access to your Google Ads API, allowing to send purchase conversions to Google Ads.

After connecting, a new Credential will appear in the list.

Open ‘Outbound’ tab to add a new outbound integration. Select new Google Ads credential, and choose ‘Purchase’ event type. Formsable will display a list of Google Ads Customers your Google account has access to manage. Choose the one that has the Conversion Action that has been created in Google Ads Manager in previous step.

Press ‘Save’ button to save settings. Formsable will start sending all purchases it attributed to Google Ads clicks to Google Ads API.

How To Attribute Conversions to Facebook Ads Click Ids

Attributing conversions to Facebook Ads is a common task, however doing it with sufficient precision is hard. Sales might happen in CRM, or, when they happen online, customer might not come back to the website, so tracking with Facebook Pixel JS produces substandard results.

Formsable resolves this by introducing concept of a Visitor. Visitor associates Events that happen on website, in CRM or offline by associating these Events using Visitor Keys. Visitor Keys are Visitor attributes that uniquely identify a customer across events and devices. The most common ones are email and phone.

In a typical integration scenario, fbclid parameter of initial hit is first associated with website-specific visitor identifier, the default being Google Analytics visitor id, and then, once a lead is submitted, associates a lead parameter such as e-mail with visitor id, and, by inference, with original fbclid.

All of this happens in Formsable engine automatically, provided PageView and Lead events are sent when respective actions occur.

Doing so requires adding following code on the website pages:

<script src="//" async></script>
window.addEventListener('load', () => {
  uipe('init', "aaaaaaaaa-aaaa-aaaaa-aaaa-aaaaaaaaaaa") // Replace with funnel mark
  uipe('track', 'PageView')
  // attach event to your form and fields; following example is for Elementor Form plugin
  for (let form of document.getElementsByClassName('elementor-form')) {
    form.addEventListener('submit', (e) => {
      gtag('event', 'generate_lead')
      uipe('track', 'Lead', {
        keys: {
        email: form.elements['form_fields[email]'].value,
        phone: form.elements['form_fields[message]'].value,
      lead: {
        firstName: form.elements['form_fields[name]'].value,
        lastName: form.elements['form_fields[field_4]'].value,
        company: form.elements['form_fields[field_1]'].value,
        country: form.elements['form_fields[field_2]'].value,

Once installed, you should be able to see Visitors with both fbclid and email keys in Formsable UI. The initial fbclid will also be used when sending configured Pixel events to Facebook Marketing API.

How To Send Funnel and CRM Purchases to a Facebook Pixel

Open Facebook Event Manager. If you don’t have a Pixel set up or would like to create new to keep track of purchases, click Add New Data Source – Facebook pixel and follow steps on screen.

Open Pixel Settings and make sure ‘Track events automatically without code’ is disabled. This is required to prevent duplicate events from being sent to Pixel from browser and server-side integration.

Press ‘Create Access Token’ button on the same page. Select a pixel you’d like to use and follow steps to create a new app. Choose to create an app in Development mode instead of Live. This is required to obtain access to Facebook Marketing API instantly.

Select or create a system user on the next step. A system user is a special Facebook user that will ‘own’ the access token, which allows not to renew the token regularly, as would be required by an integration that uses real user.

Open Facebook Business Settings for the Facebook Business that has access to the Pixel.

In Users – System Users select the System User that was created and press Add Assets to add an Ad Account that has access to the pixel with ‘Manage Ad account’ permission and an App that was created for the purpose of integration with ‘Develop app’ permission.

Once done, press ‘Generate New Token’ button, select the app and choose ads_management from the list of available permissions.

Press ‘Generate Token’ and save displayed token.

In Formsable

To begin sending Purchase events, Formsable will need to be configured with the new system user token.

Open ‘API Credentials’ and press ‘New Credential’. Select ‘Facebook’ service, enter access token that was created in the previous step. Refresh token can be left empty. Enter any name you can use to reference this token, such as name of the Facebook Business that it belongs to, in the ‘Name’ field. Press ‘Save’.

Open ‘Outbound’, press ‘New’ and select the Credential you’ve created in the previous step.

Choose desired Event Type (for example, ‘Purchase’), select Account and Adspixel from the drop-down lists below.

Press ‘Save’ once done.

All new events of selected type will now be sent to Facebook Pixel.

How To Add UTM and Referrer Data to Salesforce Leads

Being able to keep track of online marketing sources inside Salesforce CRM is a common need. This How To guide outlines the steps needed to configure Salesforce to store additional fields and instructions to set up visitor tracking necessary for gathering UTM and Referrer informations along with lead collection.

In Salesforce Setup

Open Home – Objects and Fields – Object Manager.

(Note: this guide assumes Lightning Experience is being used; legacy UI versions might have slightly different menu.)

Select Lead. Open Fields & Relationships and click New.

Choose following settings in Steps 1 and 2:

  • Data Type – Text,
  • Field Label – Referrer URL
  • Length – 255
  • Field Name – Referrer_URL

On ‘Step 3. Establish field-level security’ make sure the user that is used in integration has access to the field. Default values are sufficient most of the time.

On Step 4, click ‘Save & New‘.

Proceed adding following fields, using values below as Field Labels, setting Data Type to Text and Length to 255 and leaving everything else by default (similar to how Referrer URL was added):

  • UTM Source
  • UTM Medium
  • UTM Campaign
  • UTM Term
  • UTM Content

You can also add other fields such as ‘GA Cookie’ if you’d like Google Analytics Users Explorer Client Id to be present in Salesforce Lead, for example.

In Formsable

If you’re using Formsable to capture leads on the website, it will automatically recognise that Salesforce Leads now have new fields and will populate them with the available data.

To configure Formsable to send leads to Salesforce, open API Credential‘ in Formsable UI and click Connect – Salesforce:

Then, use Outbound Integrations – Add to enable sending of Leads tracked by Formsable to Salesforce: