Pumpjack Dataworks Analytics SDK

Initialization

Initialization

The SDK needs to be initialized before any events will be sent to the server.

Manually initialize SDK in your application class where 'Context' is activity or application context here.

Host parameter is required. Do not add https:// and trailing slash in your host.

Note: If you don’t know the host, see hosts below.

SDK requires basic permissions at the time of initialization. The BasicPermissions object needs Cookies to create its instance. You need to define the following properties to initialize the cookie object.

  • necessary : Boolean
  • preferences: Boolean
  • statistics: Boolean
  • marketing: Boolean
  • doNotSell: Boolean

If ‘necessary’ property is set to false, the SDK will not save & report the events.

val cookies = Cookies(
necessary = true,
preferences = true,
statistics = true,
marketing = true,
doNotSell = false)
val permissions = BasicPermissions(cookies = cookies)
PJDSDK.initialize(Context, "INSERT_PROVIDED_KEY_HERE" ,HOST, permissions )

After this step, proceed to Logging to make sure SDK initialization success log is printed on console.

Logging

Logs can only be enabled in Debug Mode. These logs help track initialization success/failure, requests as they are being sent out to the backend. These also help ensure the right key, value pairs are being reported to the backend for debugging purposes.

PJDSDK.showDebugLogs(DebugLog.VERBOSE)

Breaking Changes

*From version v1.4, it is mandatory to provide categories in all of the reportEvent methods. If there is no category, please provide empty strings in the last argument.

It is advisable to check all of your reportEvent methods, even if you are not getting any compilation error after updating SDK to v1.4. *

Breaking Changes in v1.7

From version v1.7, it is mandatory to provide the BasicPermissions to initialize the SDK.The BasicPermissions object needs Cookies to create its instance. If ‘necessary’ property is set to false in Cookies, the SDK will not save & report the events.

PJDSDKUser class now requires a Permissions as mandatory object to create its instance.

PJDSDKUser will no longer accept the cookie object directly. . You need to pass the cookies to the UserPermission model.

Changes in permissions:

There are notable distinctions between PJSDKModel.BasicPermissions and PJDSDKModel.Permissions. PJSDKModel.BasicPermissions only requires Cookies, while PJDSDKModel.Permissions need both Cookies & Marketing objects.

SDK needs PJSDKModel.BasicPermissions at the time initialization, and PJDSDKModel.Permissions is required when using setCurrentUser and updateUser methods.

Additionally, the initialization requirements of PJDSDKModel.Permissions no longer include doNotTrack and doNotSell.

Upload Events

The events are reported to the backend on a timely basis provisioned on the backend. However the client app can always upload events as they need to by making use of the below method.

PJDSDK.upload()

Update Permissions

If you want to update the basic permission at any point in time, you can call the following method to update the basic permission attributes. This will only be applicable on the events.

PJDSDK.updatePermissions(permissions: BasicPermissions)

Hosts

RegionHosts
United Statesus.pumpjackdataworks.com/api/sdk/v2
Europeeu.pumpjackdataworks.com/api/sdk/v2
United Kingdomuk.pumpjackdataworks.com/api/sdk/v2
Asia-Pacificap.pumpjackdataworks.com/api/sdk/v2