# Usage

# Pinch

Tip

It is recommended that you set the SDK to test mode while developing. This will allow both you and us to verify that everything is integrated correctly. Please note that this setting persists until the application is uninstalled or test mode is explicitly disabled. Refer to native Android documentation to see how to enable this for Android.

# Available consents

pinch.consents.SURVEYS
pinch.consents.ANALYTICS
pinch.consents.CAMPAIGNS
pinch.consents.ADS
1
2
3
4

# Callbacks

All the following methods have success and error callbacks, but these are optional for most of them.

# Granting consents

// Grant consents without callbacks
pinch.grant([pinch.consents.ANALYTICS]);

// Grant with success and error callbacks
pinch.grant([pinch.consents.ANALYTICS], 
    function(ok) { 
        console.log(ok) 
    }, 
    function(error) { 
        console.log(error) 
    }
);
1
2
3
4
5
6
7
8
9
10
11
12

# Revoking consents

pinch.revoke([pinch.consents.ANALYTICS]);
1

# Retrieve granted consents

pinch.getGrantedConsents( 
    function(arrConsents) { 
        console.log(arrConsents) 
    }
);
1
2
3
4
5

# Start SDK

pinch.start();
1

Note

The SDK will remember that it has been started, and subsequent calls to is unneccessary. If user clears or deletes app data, start has to be called again.

# Stop SDK

pinch.stop();
1

# Set Adid

The SDK will check if the user has limited ad tracking and only read the advertising Identifier if permitted.

pinch.setAdid(
    function(didSet) { 
        console.log(didSet) 
    }     
);
1
2
3
4
5

# Retrieve SDK status

pinch.isTracking( 
    function(sdkStarted) { 
        console.log(sdkStarted) 
    }
);
1
2
3
4
5

# Send demographic profile

pinch.sendDemographicProfileWithBirthYear(birthYear, pinch.gender.MALE);
1

# Send custom data

var type = "order";
var orderData = {
    orderId: "12", 
    items: [1, 2, 3]
};
pinch.addCustomEvent(type, orderData);
1
2
3
4
5
6

# Send metadata

Note

This method performs a PUT request, replacing any previous values sent with the same type.

var type = "name";
var userData = {
    nickname: "paperMan"
};
pinch.setMetadataWithType(type, userData,
    function(ok) { 
        console.log(ok) 
    }, 
    function(error) { 
        console.log(error) 
    }
);
1
2
3
4
5
6
7
8
9
10
11
12

# Push tokens

MessagingId is the ID used by the Pinch Platform for sending notifications to the device (eg. FCM registration id). This can be done by calling:

pinch.setMessagingId("<token>");
1

# Retrieve privacy dashboard URL

The URL for the privacy dashboard, which contains all collected data for given consent, can be retrieved by calling:

pinch.getPrivacyDashboardUrl(function(privacyUrl) { 
    console.log(privacyUrl) 
});
1
2
3

# Deleted collected PII & data

You can delete all PII and collected data about a user by calling this method. It requires an active internet connection and accepts an optional closure to verify if the request was successfully sent.

pinch.deleteCollectedData();
1

# Pinch Messaging Center

Retrieve incoming messages to user from Pinch.

pinch.getMessages(function(messages) { 
    console.log(messages) 
});
1
2
3