Troubleshooting ps.js API Calls

🚧

HTTPS is Required

HTTPS is required to send events from the snippet to PactSafe. While developing locally, you'll need to ensure that your connection is over SSL in order to see test activity in your PactSafe Site.

Testing PactSafe calls in PS.js with Console

To ensure your PS.js calls are going through, you can easily pop open your Developer Console to see calls happening in real-time. There are two types of ways you can interact with PS.js to track what's happening:

  • Easily enable debugging using _ps.debug = true; (outlined here)
  • Use one of the Triggered Events to send notifications/arguments to your console like so:
_ps.on('all', function(){
  // will log all PactSafe events to your console
  // with the arguments from each
  console.log(arguments);
});

Will yield some awesome debugging results you can see from your Dev Console:

See details of every event fired from PactSafe's PS.js so you can integrated it exactly like you want to.See details of every event fired from PactSafe's PS.js so you can integrated it exactly like you want to.

See details of every event fired from PactSafe's PS.js so you can integrated it exactly like you want to.

Here's the updated JSFiddle with exactly what you need to see:

Testing PactSafe calls using the Network pane of Chrome Developer Tools

When testing that your page is actually interacting with the PactSafe API, you can pop open your developer tools and head to the Network panel to inspect calls being made in real-time to https://pactsafe.io. You'll see a couple of calls being made:

When the Signer ID is set, you'll see two calls being made to PactSafe:

  • a call to /retrieve which grabs the version IDs for contracts in your Group accepted for a Signer.
  • a call to /send which automatically send a displayed event to PactSafe to track that a particular Signer has, in fact, seen the agreement/click-through checkbox.
You can easily explore the Network pane of your console to track what's being sent to PactSafe in real-time.You can easily explore the Network pane of your console to track what's being sent to PactSafe in real-time.

You can easily explore the Network pane of your console to track what's being sent to PactSafe in real-time.

📘

When are events sent to PactSafe?

Unless you use disable_sending: true in your _ps('create') call, events will be sent to PactSafe when:

  • Signer ID is set (by either listening to a field <input> or using _ps('set', 'signer_id', email); — a displayed event should be sent as well as a retrieve will be done to get contract IDs and version IDs of contracts already accepted by the Signer (null if they haven't been accepted yet).
  • When checking the box, an agreed event will be sent to PactSafe using https://pactsafe.io/send as outlined here
  • Optionally, you can choose to send a disagreed event when a Signer unchecks your click-through agreement.

Did this page help you?