Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Track visitors to your landing pages with unique telephone numbers from

Basic Usage

1. Include the trackdrive optimizer library on your page.

<script src=""></script>

2. Put some numbers on your page

<h1>(855) 654 2938</h1>

<p>Click this number to call now: <a href="tel:+18556542938">+18556542938</a></p>

3. Call the library with your optimizer token.

Your token can be obtained from one of your offers:

View Example Page

    var options = {
        // Your token from
        offer_token: 'xyz'

    // Each occurrence of (855) 654 2938 and +18556542938 on your HTML page will be replaced with a Trackdrive tracking number.
    Trackdrive.Optimizer.replace_all(options, [
      ['(855) 654 2938', 'human_number'],
      ['+18556542938', 'plain_number']

Success! Your default telephone number will now be replaced with dynamic tracking numbers from

Google Analytics

Automatically track the google analytics clientId by setting track_ga_client_id: true. For example:

    TrackdrivejQuery(function () {
          offer_token: 'f47c910d0b3429902ee69290009e36a4',
          track_ga_client_id: true
        }, [['(855) 654 2938', 'human_number']]);


The options available to Trackdrive.Optimizer.replace_all(options) and new Trackdrive.Optimizer(options)

parameter type example description
offer_token String '770a968e44ef341b3611c4d67619dae8' The 32 character offer token.
default_number Hash {plain_number: "+18886024660", human_number: "(888) 602-4660"} The default number that will be used if tracking is unavailable
tokens Hash {lp: "loan1"} Tokens that will be tracked.
track_ga_client_id Boolean true Enable automatically tracking the Google Analytics ClientID.
context jQuery $('#container') Number replacement will be limited to the contents of this jQuery element.
cookies Boolean false Enable/disable storing retrieved numbers in visitor's cookies.
cookies_expires Integer 1 The number of days number cookies will persist before expiring. Default: 1
done function function($number, data){ console.log($number, data); } Callback function called after each number is drawn.
selectors Hash {number: '.number'} CSS selectors used by the plugin to select DOM elements.
endpoints Hash {numbers: ''} HTTP endpoints used by the plugin when making API requests.

Advanced Developer Example


Request a number getting back JSON, using the optimizer javascript api.

// requesting a number returning JSON
var api = new Trackdrive.Optimizer({
  track_ga_client_id: true,
  default_number: {
    plain_number: "+18886024660",
    human_number: "(888) 602-4660"

// optional tokens that will be tracked by your numbers
// these values are tracked in addition to whatever url params you have defined on your offer.
var optional_tokens = {
  s1: 'kittens'

// get back a promise
var promise = api.request_number(offer_token, optional_tokens);

// once the trackdrive api responds, this promise will fire

  // assign the human number to a variable. EG: "(866) 230-0823"
  var human_number = data.number.human_number;

  // assign the plain number to a variable. EG: "+18662300823"
  var plain_number = data.number.plain_number;

  // Write the number to the page into a element with the class trackdrive-custom-number


Trackdrive.Optimizer#request_number Example API Response

  "number": {
    "id": 11270,
    "plain_number": "+18662222644",
    "extension": null,
    "checksum": "e86aa058616b3b94157c4d5ac304c880",
    "human_number": "(866) 222-2644"


Display Trackdrive tracking telephone numbers.






No releases published


No packages published