Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Moumita Mandal committed Dec 31, 2021
1 parent 2098d44 commit 3233e8b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,12 @@ class Analytics {
this.loadOnlyIntegrations,
this.clientIntegrations
);
let cookieConsent = undefined;
// Check if cookie consent manager is being set through load options
if (this.cookieConsentOptions) {
// Call the cookie consent factory to initialise and return the type of cookie
// consent being set. For now we only support OneTrust.
this.cookieConsent = CookieConsentFactory.initialize(
cookieConsent = CookieConsentFactory.initialize(
response,
this.cookieConsentOptions
);
Expand All @@ -197,8 +198,8 @@ class Analytics {
this.clientIntegrations = this.clientIntegrations.filter((intg) => {
return (
integrations[intg.name] != undefined &&
(!this.cookieConsent || // check if cookieconsent object is present and then do filtering
(this.cookieConsent && this.cookieConsent.isEnabled(intg.config)))
(!cookieConsent || // check if cookieconsent object is present and then do filtering
(cookieConsent && cookieConsent.isEnabled(intg.config)))
);
});
this.init(this.clientIntegrations);
Expand Down

0 comments on commit 3233e8b

Please sign in to comment.