Collapse Menu
Classic Docs
Order Page Config, Design and Page Flow
Advanced Features
Subscriptions and Saasy
Contact Support

Integrating Classic Google Analytics with FastSpring

Without cross-domain customizations, a visitor who first visits your website and then proceeds to your FastSpring store is counted as two separate visitors with two separate visits of different durations, which is not an appropriate model for analytics. You can, however, use Classic Google Analytics cross-domain tracking to make sure that Google Analytics records traffic to these two sites to the same report. With this site linking, a visitor to your website who proceeds to your FastSpring store is counted as one visitor—not two—and the session started on your website is continued through to the time spent on the shopping cart. This article will assist you with the integration of Classic Google Analytics Cross-Domain Customization with FastSpring.

Note: Classic Google Analytics will soon be replaced with Google Universal Analytics. You may wish to follow the setup process for Universal Analytics instead.

Initial Setup

Google Analytics Setup

If you have not already done so, sign up for a Google Analytics Account. Upon signing up, Google Analytics will provide you with a tracking code which you will paste onto your web pages and which will be used to integrate with FastSpring. An example of the format of the tracking code is UA-XXXXXXXX-X.

In Google Analytics, click on Profiles. Then click on Profile Settings. 

51.png52.png 

FastSpring recommends three specific settings: (1) in the Exclude URL Query Parameters field, exclude jsessionid, csid, (2) for Currency displayed as, select US Dollar (USD $), and (3) for E-Commerce tracking, select Yes, an E-Commerce Site.

50.png

FastSpring Setup

Go to SpringBoard's Store Home » External Tracking. Click Add Tracking Method. 

45.png46.png

FastSpring offers three tracking types: Google Analytics, Google Adwords, and custom tracking. Select Google Analytics Tracking and click Next. In the Web Property ID field, enter in the Google Analytics tracking code, and click Next.

47.png 48.png

Under Configuration Options, select true for _setAllowLinker. Make sure to leave the _setDomainName field blank. Click Save.

49.png

Updating your Webpages

Copy the following code and paste it onto every page you want to track immediately before the closing </head> tag. Be sure to replace UA-33288836-1 with your tracking code. You can also get sample code for your specific website by logging into your Google Analytics account, clicking on Tracking Code, and selecting Multiple top-level domains.

<script type="text/javascript">

var _gaq = _gaq || [];
 _gaq.push(['_setAccount', 'UA-33288836-1']);
 _gaq.push(['_setAllowLinker', true]);
 _gaq.push(['_trackPageview']);

(function() {
 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 })();

</script>

Updating Your Links

You can link from your website to the FastSpring order process in six different ways. Page linking options represent different order flows, designed to suit a variety of business needs. To see the different page linking options, go to SpringBoard's Store Home » Products and Pages » select a product » View Additional Page Linking Options. 

Simply copy and paste the HTML code, which includes the required Google Analytics information, for one of the link options into the web page that will host the purchase button / link. While you may use your own graphics to link to FastSpring, we have created several purchase buttons which you are welcome to use.

In each of these examples, the company ID is mycompany and the product's Partial URL Path Name is myproduct..

Option 1: View Product Detail Page

Sample Code:

HTML that may be embedded into an existing web page:

<a href="http://sites.fastspring.com/mycompany/product/myproduct" onclick="_gaq.push(['_link',
'http://sites.fastspring.com/mycompany/product/myproduct']); return false;">Purchase</a>

Option 2: Add Product to Order and Checkout

Sample Code:

HTML that may be embedded into an existing web page:

<form method="POST" action="http://sites.fastspring.com/mycompany/product/myproduct?action=order"
target="_top" onsubmit="_gaq.push(['_linkByPost', this]);"><input type="submit" value="Purchase" /></form>

Option 3: Short Order Process

Sample Code:

HTML that may be embedded into an existing web page:

<a href="https://sites.fastspring.com/mycompany/instant/myproduct" onclick="_gaq.push(['_link',
'https://sites.fastspring.com/mycompany/instant/myproduct']); return false;">Purchase</a>

Option 4: Shopping Cart - Add Product to Order

Sample Code:

HTML that may be embedded into an existing web page:

For display as button:

<form method="POST" action="http://sites.fastspring.com/mycompany/product/myproduct?action=add"
target="_top" onsubmit="_gaq.push(['_linkByPost', this]);"><input type="submit" value="Add to Order" /></form>

For display as link:

<form method="POST" name="f" action="http://sites.fastspring.com/mycompany/product/myproduct?action=add" target="_top"><a href="http://sites.fastspring.com/mycompany/product/myproduct?action=adds" onclick="_gaq.push(['_linkByPost', this.parentNode]); this.parentNode.submit(); return false;">Order Now</a>
</form>

Option 5: Shopping Cart - View Product Detail Page

Sample Code:

HTML that may be embedded into an existing web page:

<a href="http://sites.fastspring.com/mycompany/product/myproduct?action=adds" onclick="_gaq.push(['_link','http://sites.fastspring.com/mycompany/product/myproduct?action=adds']); return false;">Add to Order</a>

Option 6: Create Order API

Sample Code:

More often than not, you would not directly be using the example HTML forms below, but instead you would be generating their equivalent with some dynamic programming language, like PHP, JavaScript, C#/.NET.

Example Form with Quantity Box:

<form method="POST" action="http://sites.fastspring.com/mycompany/api/order" onsubmit="_gaq.push(['_linkByPost', this]);">
<input type="hidden" name="operation" value="create"/>
<input type="hidden" name="destination" value="contents"/>
<p>
<input type="hidden" name="product_1_path" value="/myproduct">
<input type="text" name="product_1_quantity" value="1"/> My Product Name
</p>
<p>
<input type="submit" value="Order Now"/>
</p>
</form>

Example Form with Checkbox:

<form method="POST" action="http://sites.fastspring.com/mycompany/api/order" onsubmit="_gaq.push(['_linkByPost', this]);">
<input type="hidden" name="operation" value="create"/>
<input type="hidden" name="destination" value="contents"/>
<p>
 <input type="checkbox" name="product_1_path" value="/myproduct"/> My Product Name
</p>
<p>
<input type="submit" value="Order Now"/>
</p>
</form>


Google Analytics Profiles

When you set up cross-domain tracking, Google Analytics suggests you do certain things with your profiles. While we have tried to summarize their suggestions below, you may want to read Google Analytic's documentation on key components for up-to-date information.

  • Set up a master profile for your primary website domain.

    It is recommended that you set up a master profile for your primary website domain that should have no filters added to it. Without filters, your master profile will always have baseline historical data for your primary website domain that you can refer to if you make errors when setting up filters in your cross-tracking profile. 
     
  • Create a profile for cross-domain tracking and re-use your tracking code.

    After you have set up a master profile and retrieved the tracking code for your primary website domain, use the same tracking code for all other web properties. In the Profiles menu, click New Profile and create a profile especially for cross-domain tracking. When you use the same tracking code, your configuration will be set up correctly before you start cross-domain tracking and you will also have historical data for all web properties. All other web properties that you want to link should also have the same tracking code on them.
    53.png
  • Modify your cross-domain profile with a filter to show the full domain in your content reports.

    Once you have domain linking established, you will see only the request URI in the content reports, and not the top-level or sub-domain for a given page. For example, for visits to the pages  http://www.example.com/index.php and another page  http://sub.example.com/more.php
    the reports will show index.php and more.php. You will not be able to distinguish which page is from which domain. To show the domain in the page reports, set a filter to include all components of the page URL by following these steps:

    1. In the Profiles menu, click Filters and then click New Filter.< br/>54.png55.png
    2. Enter in a name for this filter. For Filter Type, select Customer Filter. Then select Advanced.
    3. Set the following Advanced settings, and then be sure to click Save.
  • For FieldA, select Hostname and set the value to  (.*), which is an expression that captures all characters.
     
  • For FieldB, select Request URI and set the value to  (.*), which is an expression that captures all characters.
     
  • For Output To -> Constructor, select Request URI and provide $A1$B1 as the value for that choice. 
56.png

Your reports will now show www.example.com/index.php and sub.example.com/more.php and this will capture the www.example.com portion of your URL and include that at the beginning of your page URL in the content reports section.

We're Here to Help

For assistance with integrating Google Analytics with FastSpring, please open a support ticket.