[Developers] How to get the referrer after consent has been given?
Advanced Cookie Banner, since its 3.0.0 version, stores the referrer when the customer lands on your site, in a dedicated cookie, which can then be used by your module once consent has been given.For analytics-like modules who want to report this information, here is an example:
// Check if the module is installed and enabled if (Module::isInstalled('pm_advancedcookiebanner') && Module::isEnabled('pm_advancedcookiebanner')) { // Get an instance, and check that we are using a version that supports storing the referrer $moduleInstance = Module::getInstanceByName('pm_advancedcookiebanner'); if (version_compare($moduleInstance->version, '3.0.0', '>=')) { // Get the referrer and do your magic $referrer = AcbReferrerCookie::getReferrer(); // [...] // Once you have handled this value, you MUST clear the cookie value to avoid multiple reportings AcbReferrerCookie::remove(); } }