Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Gtm datalayer fix #3562

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Resolved eslint errors and warnings
  • Loading branch information
sandeep-deriv committed Mar 29, 2022
commit af1346d9201dda7b521fc0eb60651584a43b0048
2 changes: 2 additions & 0 deletions src/botPage/bot/TradeEngine/Purchase.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default Engine =>
// Don't unnecessarily send a forget request for a purchased contract.
this.data.proposals = this.data.proposals.filter(p => p.id !== response.echo_req.buy);
const { buy } = response;

/* eslint-disable-next-line no-unused-expressions */
GTM?.pushDataLayer?.({ event: 'bot_purchase', buy_price: proposal.ask_price });

contractStatus({
Expand Down
4 changes: 4 additions & 0 deletions src/botPage/view/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ export default class View {
this.stop();
Elevio.logoutUser();
googleDriveUtil.logout();

/* eslint-disable-next-line no-unused-expressions */
GTM?.setVisitorId?.();
removeTokens();
})
Expand Down Expand Up @@ -688,6 +690,8 @@ export default class View {
.then(() => {
this.stop();
Elevio.logoutUser();

/* eslint-disable-next-line no-unused-expressions */
GTM?.setVisitorId?.();
const activeToken = $(e.currentTarget).attr('value');
const tokenList = getTokenList();
Expand Down
2 changes: 2 additions & 0 deletions src/botPage/view/blockly/customBlockly.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ Blockly.Input.prototype.attachShadowBlock = function(value, name, shadowBlockTyp
Blockly.Toolbox.TreeNode.prototype.onClick_ = function(_e) {
// eslint-disable-next-line no-underscore-dangle
const blocklyCategoryName = translateLangToLang(_e.target.innerText, getLanguage(), 'en');

/* eslint-disable-next-line no-unused-expressions */
GTM?.pushDataLayer?.({ event: 'Click Block Category', blocklyCategoryName });

// Expand icon.
Expand Down
2 changes: 2 additions & 0 deletions src/botPage/view/blockly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ export default class _Blockly {
event.ids.forEach(id => {
const block = workspace.getBlockById(id);
if (block) {
/* eslint-disable-next-line no-unused-expressions */
GTM?.pushDataLayer?.({
event : 'Block Event',
blockEvent: event.type,
Expand All @@ -364,6 +365,7 @@ export default class _Blockly {
const dom = Blockly.Xml.textToDom(`<xml>${event.oldXml.outerHTML}</xml>`);
const blockNodes = dom.getElementsByTagName('block');
Array.from(blockNodes).forEach(blockNode => {
/* eslint-disable-next-line no-unused-expressions */
GTM?.pushDataLayer?.({
event : 'Block Event',
blockEvent: event.type,
Expand Down
1 change: 1 addition & 0 deletions src/botPage/view/blockly/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export const getMandatoryBlocks = () => config.mandatoryBlocks.map(type => getBl
export const getMandatoryMainBlocks = () => config.mandatoryMainBlocks.map(type => getBlockByType(type)).filter(b => b);

export const hasChildOfType = (block, childType) =>
/* eslint-disable-next-line no-underscore-dangle */
block.childBlocks_.find(child => child.type === childType || hasChildOfType(child, childType));

export const getMissingBlocksTypes = () => {
Expand Down
2 changes: 2 additions & 0 deletions src/botPage/view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ view.initPromise.then(() => {
$('.barspinner').hide();
window.dispatchEvent(new Event('resize'));
Elevio.init();

/* eslint-disable-next-line no-unused-expressions */
GTM?.init?.();
trackJs.configure({
userId: $('.account-id')
Expand Down
1 change: 1 addition & 0 deletions src/common/appId.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export async function addTokenIfValid(token, tokenObjectList) {
} catch (e) {
removeToken(tokenObjectList[0].token);
Elevio.logoutUser();
/* eslint-disable-next-line no-unused-expressions */
GTM?.setVisitorId?.();
throw e;
}
Expand Down
23 changes: 11 additions & 12 deletions src/common/elevio.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-underscore-dangle */
import { generateLiveApiInstance } from './appId';
// import { getLanguage } from '../common/lang';
import { getTokenList } from './utils/storageManager';
Expand All @@ -21,8 +22,8 @@ const Elevio = (() => {
};

const injectElevio = (isOpen = false) => {
window._elev = {}; // eslint-disable-line no-underscore-dangle
window._elev.account_id = accountId; // eslint-disable-line no-underscore-dangle
window._elev = {};
window._elev.account_id = accountId;

const script = document.createElement('script');
script.type = 'text/javascript';
Expand All @@ -31,30 +32,28 @@ const Elevio = (() => {
script.id = 'loaded-elevio-script';
document.body.appendChild(script);

window._elev.q = []; // eslint-disable-line no-underscore-dangle
window._elev.q = [];
window._elev.on = (z, y) => {
// eslint-disable-line no-underscore-dangle
window._elev.q.push([z, y]); // eslint-disable-line no-underscore-dangle
window._elev.q.push([z, y]);
};

script.onload = () => loadElevio(isOpen);
};

const loadElevio = (isOpen = false) => {
if (!window._elev) return; // eslint-disable-line no-underscore-dangle
if (!window._elev) return;

// eslint-disable-next-line no-underscore-dangle
window._elev.on('widget:opened', () => {
if (localStorage.getItem('seenWhatsBinaryBot')) {
window._elev.open(); // eslint-disable-line no-underscore-dangle
window._elev.open();
} else {
localStorage.setItem('seenWhatsBinaryBot', true);
window._elev.openArticle(90); // eslint-disable-line no-underscore-dangle
window._elev.openArticle(90);
}
});

// eslint-disable-next-line no-underscore-dangle
window._elev.on('load', elev => {
/* eslint-disable-next-line no-unused-expressions */
GTM?.pushDataLayer?.({ event: 'elevio_widget_load' });
const availableLanguages = ['en', 'es', 'id', 'pt', 'ru'];
const currentLanguage = getLanguage();
Expand All @@ -80,11 +79,11 @@ const Elevio = (() => {

const addEventListenerGTM = () => {
window._elev.on('widget:opened', () => {
// eslint-disable-line no-underscore-dangle
/* eslint-disable-next-line no-unused-expressions */
GTM?.pushDataLayer?.({ event: 'elevio_widget_opened', is_elevio: true });
});
window._elev.on('page:view', () => {
// eslint-disable-line no-underscore-dangle
/* eslint-disable-next-line no-unused-expressions */
GTM?.pushDataLayer?.({ event: 'elevio_page_views', is_elevio: true });
});
};
Expand Down
1 change: 1 addition & 0 deletions src/common/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const translate = (input, params = []) => {
let translatedString = i18nTranslate(stringToBeTranslated);
params.forEach((replacement, index) => {
if (translatedString && typeof translatedString === 'string') {
/* eslint-disable-next-line no-useless-escape */
translatedString = translatedString.replaceAll(`\{\$${index}\}`, replacement);
}
});
Expand Down
2 changes: 2 additions & 0 deletions src/common/utils/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,7 @@ export const loadExternalScript = (src, async = true, defer = true) =>
export const errLogger = (err, msg) => {
const errStr = JSON.stringify(err);
const errMsg = `${msg} - Error: ${errStr}`;

/* eslint-disable-next-line */
console.warn(errMsg);
};
1 change: 1 addition & 0 deletions src/indexPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const loginCheck = () => {
$('.show-on-load').show();
$('.barspinner').hide();
renderElements();
/* eslint-disable-next-line no-unused-expressions */
GTM?.init?.();
});
}
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy