JS code tips and tricks
Integration code callbacks and hacks
Implement customId for your subscribers
Add the code below to your HTML DOM Tree.
<var id="ppg-custom-id" data-id="your id here"></var>When you implement the above into your website, we will receive this data and assign it to your subscribers as an externalId. Then, you can easly send transactional messages or get subscriber details, thanks to this externalId, via our API.
Fetch subscriber ID after register
Our standard integration code allows to register callback for syncId event. When subscribers "subscribe" you can receive ID without usage of our SDK.
<script>
window.ppg = window.ppg || {};
window.ppg.register = window.ppg.register || [];
window.ppg.register.push(['syncId', subscriberId => console.log("Your SubscriberID:", subscriberId)]);
</script>
Switch for subscribe action instead of popup
It's possible to do that just add <input> with type checkbox and id="ppg-switch".
<input type="checkbox" id="ppg-switch" disabled="disabled"/>You can hide popup by setting "delay popup time" to 999999s
Example code of toggle usage with styles you can see at: https://github.com/ppgco/examples/tree/master/sdk_toggle