ackee-tracker-consent
v1.2.2
Published
A consent banner to activate detailed tracking on Ackee
Maintainers
Readme
ackee-tracker-consent
A script that creates a Consent banner to activate detailed tracking on Ackee. Just include it on your site to track and you are good to go!
📖 Table of Content
🚀 Installation
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ackee-tracker-consent.min.js"></script>
<script>
AckeeTrackerOptIn.consent('https://ackee.example.com', 'hd11f820-68a1-11e6-8047-79c0c2d9bce0')
</script>⚙️ API
.consent(serverAddress, domainId, options)
Initialize the consent. Will create a ackee-tracker instance automatically.
Be sure to assign your instance to a variable. Tracking a visit or event is only possible with an instance.
Examples:
AckeeTrackerOptIn.consent('https://ackee.example.com', 'hd11f820-68a1-11e6-8047-79c0c2d9bce0')AckeeTrackerOptIn.consent('https://ackee.example.com',
'hd11f820-68a1-11e6-8047-79c0c2d9bce0',
{
acceptButtonLabel: 'Accept',
rejectButtonLabel: 'Reject'
})Parameters:
serverAddress{String}An URL that points to your Ackee installation. TheserverAddressproperty must not end with a slash.domainId{String}Id of the domain.options{?Object}An object of options.
.optIn(shouldDeleteComponent)
Opts-In for detailed tracking
Examples:
AckeeTrackerOptIn.optIn()AckeeTrackerOptIn.optIn(true)Parameters:
shouldDeleteComponent{?Boolean}Should delete the consent banner component from the site. This is a internal-only variable and is only being used for the buttons in the banner itself. Therefore theshouldDeleteComponentproperty defaults tofalse
.optOut(shouldDeleteComponent)
Opts-Out for detailed tracking
Examples:
AckeeTrackerOptIn.optOut()AckeeTrackerOptIn.optOut(true)Parameters:
shouldDeleteComponent{?Boolean}Should delete the consent banner component from the site. This is a internal-only variable and is only being used for the buttons in the banner itself. Therefore theshouldDeleteComponentproperty defaults tofalse
.getConsentStatus()
Gets the current Consent Status
Examples:
if(AckeeTrackerOptIn.getConsentStatus()) {
console.log(true)
}Returns:
{Boolean}Returnstruewhen the user accepted the detailed tracking
🔧 Options
The option-object can include the following properties:
{
text: 'This site asks you to enable detailed tracking. Your data will help to enhance your user experience.',
acceptButtonLabel: 'Accept',
rejectButtonLabel: 'Reject',
moreInformationLabel: 'More Information',
moreInformationLink: "https://docs.ackee.electerious.com/#/docs/Anonymization",
// Activates Shadow if set to true
shadow: false,
// Possible Positions: bottom-left, bottom-right
position: 'bottom-left',
// ackee-tracker options (see https://github.com/electerious/ackee-tracker for more infos)
ignoreLocalhost: true,
ignoreOwnVisits: true
}