Right now there is no "clear cookie" function. You could add an custom js function, which gets triggered after saving the consent and insert the function name in the module config option.
One easy way to not use google analytics afterwards, would be a simple reload:
var reloadAfterConsent = function() {
window.location.reload();
};
After the reload, the google script will not be loaded again, but the cookies will remain.
To also delete existing cookies, some extra work is needed as PrivacyWire don't know, what cookies got set by which script and you probably don't want to delete all cookies.
You could write a function to check for current consent state and delete cookies, if no consent to a specific category is given.
Here is a very rough (and not tested in real life) idea, how you could do something like this:
function eraseCookie(name) {
document.cookie = name+'=; expires=Thu, 01 Jan 1970 00:00:00 UTC;';
}
var removeGoogleCookies = function() {
if(window.PrivacyWire.userConsent.cookieGroups.statistics !== true) {
eraseCookie("_ga");
eraseCookie("_gid");
// or whatever your cookie names are
}
};
And then add removeGoogleCookies to the "Trigger a custom js function" config option. This script is written with the new logic from the ES6 branch, should also work in earlier versions with different naming though.