Skip to main content

Code Snippets

Complete implementation examples for the Practice Growth Suite based on the CTD TEST documentation.

CTD TEST Configuration​

Company Details:

  • Company: CTD TEST
  • Phone: 111-123-1234
  • Location ID: 6731
  • Type: Denticon Operatory
  • Timezone: America/Chicago
  • Coordinates: 29.624042, -95.673742
  • Company Slug: DECA
  • Token: TOKEN

Widget Mode - JavaScript Initialization​

Step 1: Copy this to your website's HTML header​

Initialize as SINGLE office​

<script src="https://schedule.jarvisanalytics.com/js/init.min.js"></script>
<script>
var jarvis = new JarvisAnalyticsScheduler({
token: "TOKEN-HERE",
locationId: "6731",
companyId: "4"
});
</script>

Initialize as MULTI office​

<script src="https://schedule.jarvisanalytics.com/js/init.min.js"></script>
<script>
var jarvis = new JarvisAnalyticsScheduler({
token: "TOKEN-HERE",
companyId: "4"
});
</script>

Initialize as SAME DAY APP​

<script src="https://schedule.jarvisanalytics.com/js/init.min.js"></script>
<script>
var jarvis = new JarvisAnalyticsScheduler({
token: "TOKEN-HERE",
companyId: "4",
sameday: true
});
</script>

Step 2: Create or add this script to a button in your website​

<button type="button" onclick="jarvis.toggle()">Book an Appointment</button>

Iframe Mode - Direct Embedding​

Step 1: You can use this iframe code to embed it to your webpage​

Initialize as SINGLE office​

(function () {
var referrer = document.referrer;
iframe = document.createElement("iframe");
iframe.setAttribute("src", "https://schedule.jarvisanalytics.com/frame/DECA?location_id=6731&referrer=" + referrer);
iframe.setAttribute("class", "my-custom-class");
iframe.style.width = 100 + "%";
iframe.style.height = 100 + "%";
iframe.style.border = "none";
document.getElementById("container").appendChild(iframe);
})();

Initialize as MULTI office​

(function () {
var referrer = document.referrer;
iframe = document.createElement("iframe");
iframe.setAttribute("src", "https://schedule.jarvisanalytics.com/frame/DECA?referrer=" + referrer);
iframe.setAttribute("class", "my-custom-class");
iframe.style.width = 100 + "%";
iframe.style.height = 100 + "%";
iframe.style.border = "none";
document.getElementById("container").appendChild(iframe);
})();

Initialize as SAME DAY APP​

(function () {
var referrer = document.referrer;
iframe = document.createElement("iframe");
iframe.setAttribute("src", "https://schedule.jarvisanalytics.com/sameday/DECA?referrer=" + referrer);
iframe.setAttribute("class", "my-custom-class");
iframe.style.width = 100 + "%";
iframe.style.height = 100 + "%";
iframe.style.border = "none";
document.getElementById("container").appendChild(iframe);
})();

Step 2: (Optional) Enable Geolocation API​

For same-day appointments with geolocation support:

(function () {
var referrer = document.referrer;
iframe = document.createElement("iframe");
iframe.setAttribute("src", "https://schedule.jarvisanalytics.com/sameday/DECA?referrer=" + referrer);
iframe.setAttribute("class", "my-custom-class");
iframe.setAttribute("allow", "geolocation *");
iframe.style.width = 100 + "%";
iframe.style.height = 100 + "%";
iframe.style.border = "none";
document.getElementById("container").appendChild(iframe);
})();

Advanced Configuration Examples​

Widget with Custom Styling​

<script src="https://schedule.jarvisanalytics.com/js/init.min.js"></script>
<script>
var jarvis = new JarvisAnalyticsScheduler({
token: "TOKEN-HERE",
locationId: "6731",
companyId: "4",
title: "Book Your Appointment",
showLogo: 1,
showPhoneNumber: true,
modalMode: true,
colors: {
bodyBackground: "#F3F4F6",
headerBackground: "#FFFFFF",
primaryButtonBackground: "#007bff"
},
onOpen: function() { console.log('Scheduler opened'); },
onClose: function() { console.log('Scheduler closed'); },
onError: function(error) { console.error('Scheduler error:', error); }
});
</script>

Iframe with Custom Container​

<!-- Add a container div where you want the iframe to appear -->
<div id="container" style="width: 100%; height: 600px; border: 1px solid #ccc; border-radius: 8px;"></div>

<script>
(function () {
var referrer = document.referrer;
iframe = document.createElement("iframe");
iframe.setAttribute("src", "https://schedule.jarvisanalytics.com/frame/DECA?location_id=6731&referrer=" + referrer);
iframe.setAttribute("class", "my-custom-class");
iframe.style.width = 100 + "%";
iframe.style.height = 100 + "%";
iframe.style.border = "none";
iframe.style.borderRadius = "8px";
document.getElementById("container").appendChild(iframe);
})();
</script>

Implementation Notes​

Widget Mode​

  • Interactive: Uses jarvis.toggle() method for user interaction
  • Modal: Creates a popup overlay with backdrop
  • Customizable: Supports colors, styling, and event handlers
  • Event Handling: Provides onOpen, onClose, and onError callbacks

Iframe Mode​

  • Direct Embedding: Integrates directly into your page layout
  • Responsive: Adapts to container dimensions
  • Geolocation: Supports location-based scheduling for same-day appointments
  • Tracking: Uses document.referrer for analytics

URL Patterns​

  • Single Office: /frame/DECA?location_id=6731&referrer=
  • Multi Office: /frame/DECA?referrer=
  • Same Day: /sameday/DECA?referrer=

Required Parameters​

  • token: Authentication token (required)
  • companyId: Company identifier (required)
  • locationId: Specific office location (for single office mode)
  • sameday: Enable same-day scheduling (boolean)

Optional Parameters​

  • title: Custom widget title
  • showLogo: Show/hide company logo (1 or 0)
  • showPhoneNumber: Show phone number button (true/false)
  • modalMode: Enable modal overlay (true/false)
  • colors: Custom color scheme object
  • onOpen/onClose/onError: Event handler functions