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!
<script src="https://cdn.jsdelivr.net/npm/ackee-tracker-consent@1.2.2/dist/ackee-tracker-consent.min.js"></script>
<script>
AckeeTrackerOptIn.consent('https://ackee.example.com', 'hd11f820-68a1-11e6-8047-79c0c2d9bce0')
</script>
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. TheserverAddress
property must not end with a slash.domainId
{String}
Id of the domain.options
{?Object}
An object of options.
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 theshouldDeleteComponent
property defaults tofalse
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 theshouldDeleteComponent
property defaults tofalse
Gets the current Consent Status
Examples:
if(AckeeTrackerOptIn.getConsentStatus()) {
console.log(true)
}
Returns:
{Boolean}
Returnstrue
when the user accepted the detailed tracking
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
}