import React from 'react';
import ReactDOM from 'react-dom';
import Logo from './react-components/logo.jsx';
import Footer from './react-components/footer.jsx';
import { getTokenList } from '../common/utils/storageManager';
import { oauthLogin } from '../common/appId';
import { createUrl } from '../common/utils/tools';
import { load as loadLang } from '../common/lang';
import '../common/binary-ui/dropdown';
import endpoint from './endpoint';
import isEuCountry from '../common/footer-checks';

const renderElements = () => {
    const showHideEuElements = isEu => {
        $('.eu-hide').attr('style', `display: ${isEu ? 'none' : 'block'} !important`);
        $('.eu-show, .eu-only').attr('style', `display: ${isEu ? 'block' : 'none'} !important`);
    };
    ReactDOM.render(<Logo />, document.getElementById('binary-logo'));
    ReactDOM.render(<Footer />, document.getElementById('footer'));
    isEuCountry().then(isEu => {
        showHideEuElements(isEu);
    });
    $('#shop-url').attr('href', createUrl({ subdomain: 'shop', path: 'collections/strategies', isNonBotPage: true }));
};

const loginCheck = () => {
    if (endpoint()) return;
    if (getTokenList().length) {
        window.location.pathname = `${window.location.pathname.replace(/\/+$/, '')}/bot.html`;
    } else {
        loadLang();
        oauthLogin(() => {
            $('.show-on-load').show();
            $('.barspinner').hide();
            renderElements();
        });
    }
};

loginCheck();

@@ -54,16 +54,51 @@
 t-dom';%0A
+import endpoint from './endpoint';%0A
 import L
@@ -198,28 +198,26 @@
 mport %7B 
-getTokenList
+oauthLogin
  %7D from 
@@ -231,97 +231,116 @@
 mon/
-utils/storageManager';%0Aimport %7B oauthLogin %7D from '../common/appId';%0Aimport %7B createUrl %7D
+appId';%0Aimport '../common/binary-ui/dropdown';%0Aimport isEuCountry from '../common/footer-checks';%0Aimport GTM
  fro
@@ -356,18 +356,13 @@
 mon/
-utils/tool
+gtm.j
 s';%0A
@@ -423,93 +423,84 @@
 ort 
-'../common/binary-ui/dropdown';%0Aimport endpoint from './endpoint';%0Aimport isEuCountry
+%7B getTokenList %7D from '../common/utils/storageManager';%0Aimport %7B createUrl %7D
  fro
@@ -508,36 +508,34 @@
  '../common/
-footer-check
+utils/tool
 s';%0A%0Aconst r
@@ -1472,24 +1472,48 @@
 Elements();%0A
+            GTM.init();%0A
         %7D);%0A

Call GTM.init(), re-order imports