Skip to content

Commit

Permalink
Add alter message functionality after deactivate google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
keshikashviligio committed May 24, 2018
1 parent 8da1cc7 commit 18668df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion ApGaOptOut.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
this.gaOptOutCookiePrefix = options.gaOptOutCookiePrefix;
this.optOutCallEvent = options.optOutCallEvent;
this.elementSelector = options.elementSelector;
this.showAlterAfterDeactivate = options.showAlterAfterDeactivate;
this.alterMessage = options.alterMessage;

this.init();
};
Expand All @@ -26,7 +28,9 @@
gaAppId: '',
gaOptOutCookiePrefix: 'ga-disable-',
optOutCallEvent: 'click',
elementSelector: ''
elementSelector: '',
showAlterAfterDeactivate: false,
alterMessage: 'Google Analytics tracking has been deactivated in your browser for this website.'
};


Expand Down Expand Up @@ -113,6 +117,9 @@
this._log('Google analytics has disabled successfully.');
this._setOptOutCookie();
window[this.gaOptOutCookiePrefix + this.gaAppId] = true;
if(this.showAlterAfterDeactivate){
window.alert(this.alterMessage);
}
},


Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
gaAppId: 'AU-sasdas-d',
optOutCallEvent: 'click',
elementSelector: '[href="#jsgaoptout"]',
debug: false
debug: false,
showAlterAfterDeactivate: true
});
}
})();
Expand Down

0 comments on commit 18668df

Please sign in to comment.