Pumpjack Dataworks Analytics SDK

Initialization

The SDK needs to be initialized before any events will be sent to the server. You can track events before the SDK is initialized and the SDK will hold on to those events until initialize has been called.

pjdwsdk.init('<INSERT_API_KEY_HERE>', { host: '<INSERT_HOST_URL_HERE>', ...options });
const cookiePermissions = {
necessary: true,
preferences: true,
statistics: true,
marketing: true,
do_not_sell: true
};
// Allow permission to start registering events
// `cookiePermissions.necessary` should be `true` in order to start tracking.
pjdwsdk.setCookiePermissions(cookiePermissions);

This should be performed once on page load.

Examples

Zero Config

pjdwsdk.init('<INSERT_API_KEY_HERE>', { host: '<INSERT_HOST_URL_HERE>' });

With Custom Permissions

const cookiePermissions = {
necessary: true,
preferences: true,
statistics: true,
marketing: true,
do_not_sell: true,
custom: {
facebook_targetted_ads: true
}
};
pjdwsdk.setCookiePermissions(cookiePermissions);

Adding more Custom permissions

const morePermissions = {
custom: {
push_notification: true
}
}
pjdwsdk.setCookiePermissions(morePermissions);

With Automated Click Tracking

This configuration will track all things that the sdk is capable of automatically tracking. Since clicks are not tracked by default, we have to add that in the options. Please review the options below to see reasons why you might not want to track clicks automatically.

pjdwsdk.init('<INSERT_API_KEY_HERE>', { trackClicks: true, host: '<INSERT_HOST_URL_HERE>' });

Hosts

RegionHosts
United Stateshttps://us.pumpjackdataworks.com/api/sdk/v2
Europehttps://eu.pumpjackdataworks.com/api/sdk/v2
United Kingdomhttps://uk.pumpjackdataworks.com/api/sdk/v2
Asia-Pacifichttps://ap.pumpjackdataworks.com/api/sdk/v2

options

PropertyTypeDescription
hoststring(Required) Provides the regional endpoint to send collected data.
appVersion?string(Optional) The version of your application/website.
flushInterval?number(Optional) Time in seconds between when events should be sent to server. Defaults to
10
.
trackClicks?boolean(Optional) Clicks are **not** tracked by default. To track clicks automatically with assumed behavior, set this to
true
. This is highly discouraged. Tracking clicks with the
clicked
function will result in cleaner data since you are in control of what you are sending to the server.
trackLinks?boolean(Optional) Outbound links are tracked by default. **NOTE:** If your links are triggered through JavaScript, you will need to track these manually. Also, we cannot detect when a user has right-clicked on a link to open in a new tab.
trackPageBackgrounded?boolean(Optional) We will automatically track whenever the page loses visibility and also when it regains it. Manually setting this to
false
will disable that behavior.
trackPageClosed?boolean(Optional) We will automatically track when the page is closed. Manually setting this to
false
will disable that behavior.
trackPageViews?boolean(Optional) Page views are tracked by default. Some SPA's may cause this feature to not work as expected. To stop the automatic tracking of page views, set this to
false
.
debug?boolean(Optional) Setting this to true will provide console messages to assist in debugging and confirming the SDK.


CookiePermission interface

Properties

PropertyTypeDescription
necessaryboolean(Required)
preferencesboolean(Required)
statisticsboolean(Required)
marketingboolean(Required)
do_not_sellboolean(Required)
custom?object(Optional)