Integration Docs

Description: Total Profit allows Finch to optimize your paid search in order to maximize the total profit available. Rather than focusing on a cost per conversion or cost per sales, Total Profit looks at costs and revenues to find the sweet spot for profitability.


Many companies have both an eCommerce system for selling products online and an Enterprise Resource Planning (ERP) system for managing their operations - including accounting systems, CRM, warehousing, and order fulfillment. Accessing ERP data during an eCommerce transaction is typically difficult; however, data in an ERP system can be invaluable for optimizing your paid search.

Total Profit allows Finch to optimize your account based on some metric other than number of conversions (CPA) or conversion value (CPV). Presumably this metric will almost always be profit, but it doesn't have to be - it can be any one metric that is key to your business (estimated lifetime value of customer, estimated lead worth, etc...).

There are two main options to start optimizing for profit:

  1. Enter product costs, category profit percentages, and/or default profit percentages
  2. Send a Profit Feed with transactions and profit amount per transaction
    1. Each of these methods have advantages and disadvantages. See the Different Ways of Calculating Profit section below or talk to your Finch representative.

      How does it work?

      Using a combination of data from Google Analytics (GA) and your data from your ERP or other system, Finch can correlate and use your transactional data.


      1. You must be using Finch's Cost per Value (CPV) model and doing eCommerce.
      2. You must be using Google Analytics eCommerce tracking. The exact requirements for the fields included in your eCommerce tracking code depend on which profit calculations are used (see below). To make sure that all calculations have the required data, use both the addTransaction and addItem Google Analytics operations to record all orders and order line items in your Google Analytics tracking code. addTransaction should include the transaction id and revenue fields. addItem should include the transaction id, SKU, category, price, and quantity fields.
      3. You must link your Google Analytics and Google AdWords accounts. They must be linked with autotagging enabled (which is the default when you link GA with AdWords) so that GA's eCommerce tracking is attributing transactions to the appropriate AdWords keywords. If you do not have this integrated currently, then you must link the accounts and then wait until the Finch campaign has at least 50 conversions and at least a week of data.
      4. For the EAP, we can only use data from Finch campaigns, so you must be a current customer with enough data in your Finch campaign (at least 50 conversions and at least a week of data - more is better).
      5. If using the profit feed, it must be submitted daily with all the previous day’s transactions. Do not wait for payment to clear or an order to ship before including it in the feed. The value of the order can be set to zero in a later feed if it needs to be reversed due to a return, cancellation, etc.
      6. Total Profit is currently only available on Search and Shopping campaigns (display campaigns are not supported).



      First, Finch will use Google Analytics API to access your e-commerce transaction information, including a transaction id, revenue, sku, product category, etc. as well as AdWords details (the keyword, ad group, click date, etc.). Therefore Finch will require API access to your Google Analytics account:

      • Log into Finch
      • Go to 'Main >> Google Analytics Settings'.
      • Press the 'Grant Access' button; you will be prompted to log into your Analytics account and grant access to Finch.
      • Inform your Finch representative which GA profile contains your ecommerce transactions.

      Second, you'll want to take a look at the eCommerce Tracking options in Google Analtyics Developer's Guide.

      When you move to Analytics tracking, you'll have to do some development on your side. The script on your "thank you" confirmation page will look something like this - but you'll need your website platform (PHP, .NET, Java, whatever) to insert the correct values dynamically.

      You'll need the basic analytics tracker already on the page, then you'll also need to load the ecommerce plugin:

      ga('require', 'ecommerce');
      For the transaction, you'll want to have your order number as the ID. This will be the link back into your system.
      ga('ecommerce:addTransaction', {
      'id': '1234',                     // Transaction ID. Required.
      'affiliation': 'Acme Clothing',   // Affiliation or store name.
      'revenue': '11.99',               // Grand Total.
      'shipping': '5',                  // Shipping.
      'tax': '1.29'                     // Tax.

      Then for each item in the cart, you'll want to also have the following... again using the order number from your system as the ID.

      Note: Below you have the option to set Category-level profit margins. You can do this using Product Category or Brand, but it must match what you're sending in the highlighted category field.

      ga('ecommerce:addItem', {
      'id': '1234',                     // Transaction ID. Required.
      'name': 'Fluffy Pink Bunnies',    // Product name. Required.
      'sku': 'DD23444',                 // SKU/code.
      'category': 'Party Toys',         // Category or variation.
      'price': '11.99',                 // Unit price.
      'quantity': '1'                   // Quantity.

      Then at the end you'll send the transaction to Google:


      Different Ways of Calculating Profit

      To optimize your AdWords bids for profit, Finch must know the profit for each ecommerce transaction attributed to an AdWords click by Google Analytics. There are four different ways that Finch can calculate profit for an ecommerce transaction. They are listed here in the amount of work it will likely take you to implement, from easiest to hardest:

      1. Default profit percentage--calculate profit by multiplying the price of Google Analytics order line items for a campaign group by a profit percentage value defined by you.
      2. Category profit percentage--similar to the default profit percentage calculation, but allows you to define a profit percentage for each product category in a campaign group.
      3. Product cost--calculate profit by subtracting the cost of the products, provided by you, in an order from the total revenue of each order reported by Google Analytics.
      4. Profit feed--you supply the profit for each order in an XML feed uploaded daily to Finch.

      You may use more than one of these ways of calculating the profit for an order at the same time. If more than one profit calculation is possible, then the profit value assigned to the order is the first available calculation from this list:

      1. Profit feed
      2. Product cost
      3. Category profit percentage
      4. Default profit percentage

      One strategy to consider is to first implement Total Profit using some of the easier calculation techniques like category and default profit percentages, and then progress to more accurate calculation techniques like product cost and the profit feed later on.

      Sending the Feed to Finch

      After the feed has been built, Finch expects a new copy of the feed daily. This can be done one of two ways:

      • POSTing the Feed to Finch - This is Finch's preferred method for security reasons.
      • Scheduling the Feed for Download by Finch - This is the simplest method, but requires the feed to be publicly available.

      Select one of the following options for more details:

      Using the Profit Feed for Subscription or Lead Generation Websites

      The profit feed can also be used by businesses that are not eCommerce, such as subscription based businesses with free trials or companies where the website is used to generate leads which are then closed offline. The profit feed is a good mechanism to associate value or profit with these actions (like filling out a form or signing up for a trial), where the value to associate with the action is not known at the time the action occurs.


      Everywhere on the site that a new user or lead can be created or register (e.g. for a free trial signup or download, outright immediate subscription purchase, new registration or quote request form submittal, etc.), you must record a Google Analytics eCommerce transaction on the receipt / acknowledgement page. Its transaction id should be the non-changeable unique identifier for that user in your system (e.g. not the email address or username, if those can be changed later on). With this in place, the daily XML feed that you send us can simply contain the user ids and the value you would like to associate with each user, including 0 (for those that signed up for a trial but never bought a subscription, or a lead that never became a paying customer). That value can be subscription value, profit, lifetime value, etc. -- whatever you would most like to optimize for. The value associated with a particular user id is updated whenever it is present in the feed -- e.g. it can be updated with revenue after a trial period ends, additional revenue from subscription renewal (if you are optimizing for lifetime value), updated to 0 if a user cancels a subscription for a refund, etc.

      In summary, by recording an eCommerce transaction at the time a user is first created, Google Analytics can tell us what brought a user to your site to register in the first place; your feed associating that transaction (user) to value that occurs later on in time allows us to associate that value with the advertising that brought the user to your site to register or fill out a form, and then optimize accordingly.

      Below are a few implementation details.

      Record Only for New Users

      It is important to only record this eCommerce transaction whose transaction id is the user id for a brand new user. For instance, if your website has the ability to upgrade from free trials to paid subscriptions, purchase renewal subscriptions, etc., these Google Analytics transactions should not be created (because the user presumably already exists in cases like these).

      The reason for that is that we want Google Analytics to keep that transaction id (your user id) associated with whatever caused the user to come to your site and initially register, rather than however they happened to come to your site on that particular day to do something like renew their subscription (most likely through directly typing in the URL into the address bar). I.e. these transactions are meant to record only the "transaction" of a new user, not actual purchases, etc.

      Working with Existing eCommerce Tracking

      If you are currently tracking Google Analytics eCommerce transactions on your site for other purposes, in order to not interfere with reporting on those transactions, we recommend using a separate Google Analytics web property to track these conversions. This will keep your reporting in your existing Analytics property unchanged and avoid confusion that can arise from multiple transactions being potentially tracked for the same event (one from your existing Analytics tracking and one from the new Analytics tracking you add to support Total Profit).

      The safest way to record these new transactions is to use a separate, named Analytics "tracker" for this new property on the receipt / acknowledgement page. This will ensure that even if you are already tracking an eCommerce transaction on that particular page for your existing Analytics property, the new transaction tracking will not interfere. See this link for more information.

      Example javascript is below, with the Analytics tracker named "usertrans" recording transactions that have user ids as the transaction id in this new property.

      • Newer analytics.js Javascript Example:
        ga('create', '<YOUR NEW PROPERTY ID>', 'auto', {'name': 'usertrans'});
        ga('usertrans.require', 'ecommerce', 'ecommerce.js');
        ga('usertrans.send', 'pageview');
        ga('usertrans.ecommerce:addTransaction', {
            'id' : '<USER ID HERE>',
            'affiliation' : '',
            'revenue' : '0',
            'shipping' : '0',
            'tax' : '0'
      • Older ga.js Javascript Example:
        _gaq.push(['usertrans._setAccount', '<YOUR NEW PROPERTY ID>']);
           '<USER ID HERE>', // transaction ID
           '', // affiliation or store name
           '0',// total
           '0',// tax
           '0',// shipping
           '', // city
           '', // state or province
           ''  // country
      Long Delays Before Conversion

      If you have a long trial period or sales cycle, like 30 days, before users become paying customers, in order to make our optimization more effective, you should assign some initial non-zero value to the user id in the feed before they actually become a paying customer. This should be based on your estimate of the likelihood that they will become a paying customer and your estimate of what their value or profit will be if they become a paying customer. Usually, this will just be based on your average conversion rate and average conversion value.

      If, in your business, the longer that the trial period goes on without cancellation, the more likely the person is to become a paying customer, you can continue to update their value in the daily XML file with an updated estimate. Eventually, you will know that they have either converted into a paying customer or are not going to, at which point, you can simply update their value in the daily XML file to that known amount.

      Forcing Analytics to use AdWords Attribution

      Google AdWords tracking attributes any clicks during the purchase process back to AdWords. Analytics only attributes direct AdWords conversions back to AdWords. So the difference in AdWords and Analytics conversions can be dramatically different. Finch is experimenting with a way to have Analytics attribute the same as AdWords.

      1. In your Analytics, go to Admin >> Property (in the middle) >> Custom Definitions >> Custom Dimensions. Create a new Custom Dimension. Name it 'gclid'. Set the scope to User. Make it Active. Note the dimension number.
      2. In your analytics javascript on all pages, you'll need to add the highlighted section above the 'send','pageview'. In the line that says "ga('set','dimension1',gclid) you'll need to edit dimension1 to be the dimension you created in step one.
      ga('create', 'UA-XXXXXXX-9', 'auto');
      //Add the following lines
      var match = RegExp('[?&]gclid=([^&]*)').exec(;
      var gclid = match && decodeURIComponent(match[1].replace(/\+/g, ' '));
      // Change dimension1 below to the dimension created in Google Analytics
      	ga('set', 'dimension1', gclid);
      //Add the above lines
      ga('send', 'pageview');

      Contact Info

      If you have any questions about the feed or how to submit it, please contact Jason Lowry at This e-mail address is being protected from spambots. You need JavaScript enabled to view it..