mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge branch 'main' into Item-page-redirects
This commit is contained in:
@@ -6,7 +6,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { bootloader } from '@angularclass/bootloader';
|
||||
|
||||
import { load as loadWebFont } from 'webfontloader';
|
||||
import { hasValue, isNotEmpty } from './app/shared/empty.util';
|
||||
import { hasValue } from './app/shared/empty.util';
|
||||
|
||||
import { BrowserAppModule } from './modules/app/browser-app.module';
|
||||
|
||||
@@ -25,25 +25,9 @@ export function main() {
|
||||
}
|
||||
});
|
||||
|
||||
addGoogleAnalytics();
|
||||
|
||||
return platformBrowserDynamic().bootstrapModule(BrowserAppModule, {preserveWhitespaces:true});
|
||||
}
|
||||
|
||||
function addGoogleAnalytics() {
|
||||
// Add google analytics if key is present in config
|
||||
const trackingId = environment.gaTrackingId;
|
||||
if (isNotEmpty(trackingId)) {
|
||||
const keyScript = document.createElement('script');
|
||||
keyScript.innerHTML = `(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');`
|
||||
+ 'ga(\'create\', \'' + environment.gaTrackingId + '\', \'auto\');';
|
||||
document.body.appendChild(keyScript);
|
||||
}
|
||||
}
|
||||
|
||||
// support async tag or hmr
|
||||
if (hasValue(environment.universal) && environment.universal.preboot === false) {
|
||||
bootloader(main);
|
||||
@@ -51,4 +35,3 @@ if (hasValue(environment.universal) && environment.universal.preboot === false)
|
||||
document.addEventListener('DOMContentLoaded', () => bootloader(main));
|
||||
}
|
||||
|
||||
import 'zone.js/dist/zone';
|
||||
|
Reference in New Issue
Block a user