Install Metrics on Your Website

  1. Enter Tracking Parameters
    Enter the access key received from the dealer
    Advanced Options
  2. Install on all pages and all lead forms that are embedded within an iframe

    Copy and paste this code ONLY once after the opening <body> and before the closing </body> tag on all pages. Please place this code in the website header.

                      
      <script>
        /**
         * By placing this code on your website, you authorize CarGurus to access
         * and use website visitor data to optimize digital advertising performance.
         */
        ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
        p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
        };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
        n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d3j1weegxvu8ns.cloudfront.net/t.js","snowplow"));
    
        window.snowplow('newTracker', 'cgtracker', 'sp.cargurus.com', {
          
          discoverRootDomain: true,
          forceSecureTracker: true,
          contexts: {
            webPage: true,
            performanceTiming: true
          }
        });
        window.snowplow('enableActivityTracking', 5, 5);
        window.snowplow('trackPageView');
        window.snowplow('enableLinkClickTracking');
        var CarGurus = window.CarGurus || {}; window.CarGurus = CarGurus;
        CarGurus.Partner = window.CarGurus.Partner || {};
        CarGurus.Partner.Metrics = window.CarGurus.Partner.Metrics || {};
        CarGurus.Partner.Metrics.Options = window.CarGurus.Partner.Metrics.Options || {};
    
        CarGurus.Partner.Metrics.Options.debug = false;
        (function() {
          var script = document.createElement('script');
          script.src = "https://static.cargurus.com/js/api/en_US/2.0/partnermetrics.js";
          script.async = true;
          var entry = document.getElementsByTagName('script')[0];
          entry.parentNode.insertBefore(script, entry);
        })();
      </script>
      <noscript>
        <div style="display:inline;">
          <img height="1" width="1" style="border-style:none;" alt=""
    
        </div>
      </noscript>
                      
                    
Need help?

Refer to the Troubleshooting section, or contact us at rpm-launch@cargurus.com.

Troubleshooting Website Metrics

Is your website usage data not updating? Here are some things to try.
  1. Wait!

    Usage data from one day will not appear on your dealer dashboard until the next calendar day.

  2. Verify your access code

    CarGurus has assigned your dealership a unique access code. Make sure that the script that you added to your site uses the correct access code. To generate the correct script, enter your access code in our Installation Tool.

  3. Check the position of the CarGurus script within your dealership's webpages

    Make sure that the <script> tag that you have added to each page is after the opening <body> and before the end </body> tag.

    Each block of CarGurus code should appear only once in the body of each page.

  4. Make sure that your pages are accessing CarGurus' API

    Open the developer tools for your browser and go to the Network tab. Reload your page, and then confirm that a request is being made to recordMetricsData.action or recordMetricsImage.action. If no request is being made, check again that the CarGurus script is in the right place in your pages, or tell Customer Support

  5. Check the javascript console for errors

    Open the developer tools for your browser and go to the Javascript console. Reload your page. If you see errors and messages in the console, they may help you determine the problem. If you're still experiencing issues, contact our customer support team and include the errors you're seeing.

  6. Turn on the debugging option in the CarGurus script

    CarGurus provides an option to print debugging information to the Javascript console. To turn this on, look for this line in the CarGurus script on your page:

    window.CarGurus.Partner.Metrics.Options.Debug = false;

    Change the line so that window.CarGurus.Partner.Metrics.Options.Debug is true:

    window.CarGurus.Partner.Metrics.Options.Debug = true;

    You can also regenerate the script to insert in your pages by going to our Installation Tool, clicking on "Advanced Options", and selecting "Enable debug messages."

    Open the Javascript console in your browser's developer tools and reload the page. You should see debugging information printing out as the page loads.

    Any console messages from our script will start with

    CarGurus.Partner.Metrics

    These messages may be able to help you or our customer support team diagnose the problem.

Still not seeing your website metrics? Contact rpm-launch@cargurus.com.

Tracking Pixel Documentation

Events

The scripts installed on your website send events (messages) to CarGurus that track what pages are loaded and what actions your users take.

The events that CarGurus tracks are:

Event Usage
Search A Search event is sent when a user views results of a search (a search results page or SRP).
Details A Details event is sent when a user views information about a specific vehicle for sale (a vehicle details page or VDP)
Lead A Lead event is sent when a user submits a lead.
Form A Form event is sent when a user submits a form that contains user contact information. This event should NOT be sent for a lead form submission. Examples of non-lead form submissions with user contact information might include: a chat or text session, scheduling a test drive, a financing application, a service appointment, a request for trade in valuation, etc.
Save A Save is sent when a user saves, shares or emails a listing. It can also be used when the user performs any other listing-specific action you consider valuable. This event should NOT be used after form submissions that do not capture contact information.
Directions A Directions event is sent when a user requests information about your dealership, such as a map, directions or hours.
KeyPage A KeyPage event is sent when the user perfoms an action that you would like to track that is not covered by other events. For example: specials page, coupons page, promotions page, or incentives page.

Any other events sent to CarGurus will not be processed.

CarGurus tries to determine which events to send when a page loads based on the URL structure. If you need help configuring this or you believe that the wrong events are being sent, contact customer service.

If you need to fire events when the user performs an action, instead of on a page load, you can use the record function in our API to fire them.

    window.CarGurus.Partner.Metrics.Code.record(url, listOfEvents)

where

url: The url of the page
listOfEvents: An array of events to fire, e.g. ['Details', 'KeyPage']

This may be useful if your site is a single-page application.

Options (Settings)

In the script that you have added to your pages, CarGurus.Partner.Metrics.Options is a map of property names to property values. Properties in this map determine how CarGurus tracks your site usage.

Option Name Javascript Type Description
AccessKey string CarGurus assigns each account a unique access key. Use the access key assigned to you by CarGurus.
Debug boolean When this option is set to true, debugging information will be printed to the Javascript console, accessible via the developer tools in your browser. This information can be used to diagnose and fix problems with your installation. By default this option is turned off.

You can set the options either as one map:


  var CarGurus = window.CarGurus || {}; window.CarGurus = CarGurus;
  CarGurus.Partner = window.CarGurus.Partner || {};
  CarGurus.Partner.Metrics = window.CarGurus.Partner.Metrics || {};
  CarGurus.Partner.Metrics.Options =
               { AccessKey : "00000000-0000-0000-0000-000000000000",
                 debug : false }
               

or one by one in individual statements:


var CarGurus = window.CarGurus || {}; window.CarGurus = CarGurus;
CarGurus.Partner = window.CarGurus.Partner || {};
CarGurus.Partner.Metrics = window.CarGurus.Partner.Metrics || {};
CarGurus.Partner.Metrics.Options = window.CarGurus.Partner.Metrics.Options || {};
CarGurus.Partner.Metrics.Options.AccessKey = "00000000-0000-007d-0000-00000005ba1d";
CarGurus.Partner.Metrics.Options.debug = false;