Reach out with questions, bugs, or suggestions. We'll respond ASAP. Your message is sent! We'll respond via email shortly.

Overview

Heap is a modern take on analytics. There's no need to ship event tracking code, no need to wait days or weeks for data to accumulate, no need to muddle your codebase, and no need to fumble with rigid reports.

For the first time, meaningful product questions can be answered just as soon as they're asked.

Installation

Web

To get started with Heap, paste the following code snippet before your website's closing </head> tag:

  <script type="text/javascript">
    window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(r?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","removeEventProperty","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};
    heap.load("YOUR_APP_ID");
  </script>

iOS

We recommend using Cocoapods to quickly and easily add Heap:

  1. Install Cocoapods by running sudo gem install cocoapods.
  2. Create a file in your Xcode project directory called Podfile.
  3. Add the following line to your Podfile:
      pod 'Heap'
  4. Run pod install within your Xcode project directory.
  5. Initialize Heap with your app ID. We recommend doing this in applicationDidFinishLaunching: or application:didFinishLaunchingWithOptions: in your Application delegate as follows:

      #import "Heap.h"
    
      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
          [Heap setAppId:@"YOUR_APP_ID"];
      #ifdef DEBUG
          [Heap enableVisualizer];
      #endif
    
          /* Other launch code goes here */
    
          return YES;
      }
  6. Make sure you open the file with the extension .xcworkspace

Or you can install Heap manually:

  1. Download the Heap iOS library.
  2. Unzip the downloaded file and drag libHeap.a and Heap.h into your XCode project. Make sure to select Copy items if needed.
  3. Click on the project (blue project icon), and select "Build Settings".
  4. Within Build Settings, change "Other Linker Flags" to include -all_load -ObjC as a flag.
  5. Link your app to these libraries:
    • CFNetwork.framework
    • Foundation.framework
    • libicucore.dylib
    • Security.framework
    • SystemConfiguration
    • UIKit
  6. Initialize Heap with your app ID, as illustrated in the code snippet above.
Using Heap with Swift:

The Heap library should work fine if you use an Objective-C bridge header with your Swift project.

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.

        Heap.setAppId("YOUR_APP_ID");
        #if DEBUG
            Heap.enableVisualizer();
        #endif

        return true
    }

Having trouble with iOS installation? Here are solutions for common problems.

After installing Heap on web or iOS, navigate to the app. On the right side, under 'Suggested Events', you'll see a list of the most popular user interactions happening in your app. All you need to do is simply tag events of interest, and you can begin running analytics on them immediately. Suggested Events Screenshot

Custom Integrations

Wordpress

Installation on Wordpress is simple:

  1. Login to your Wordpress Admin console (generally at /wp-admin on your Wordpress site).
  2. Navigate to the Theme Editor:
  3. Locate the header.php file:
  4. Paste the following code snippet before the line of code that says </head>:
      <script type="text/javascript">
        window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(r?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","removeEventProperty","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};
        heap.load("YOUR_APP_ID");
      </script>
  5. It should look something like this:
  6. That's it! You're ready to begin using Heap.

Squarespace

Easily install Heap on Squarespace:

  1. In the Home Menu of Squarespace click Settings, followed by Advanced, and then Code Injection
  2. Select Header as your code injection field so Heap is injected to the tag on your site
  3. Copy and paste the code snippet into the Header field and Save!
      <script type="text/javascript">
        window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(r?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","removeEventProperty","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};
        heap.load("YOUR_APP_ID");
      </script>
  4. That's it! You are ready to use Heap. For more help visit Squarespace's Help Page

Shopify

If Shopify is hosted on your domain, all you need to do is include our installation snippet in your theme.liquid and checkout.liquid files.

If you are using Shopify's domain and your site uses SSL you can embed an iframe on the thank you page to track how many people are completing their purchase:

  1. Starting at your Shopify admin, click Settings, and then Checkout.
  2. Scroll down to the Order processing section and select Additional content & scripts.
  3. Insert an iframe into the text field. It will vary based on your site, but the iframe should look something like:
     <iframe src="https://your_site_url.com/store?thank-you" style="display: none"></iframe>
  4. In Heap, create a Page View event and add a filter for query contains thank-you
  5. You're ready to check out how many users are purchasing items from your site! For more help customizing your Shopify page visit Shopify's documentation on thank you pages

Advanced Configuration

heap.load() can take an optional Javascript object as its second argument for additional configuration options:

Here's an example with all options enabled:

  <script type="text/javascript">
    heap.load("YOUR_APP_ID", {
      forceSSL: true,
      secureCookie: true,
      disableTextCapture: true
    });
  </script>