diff --git a/.eslintrc b/.eslintrc
index 582942b284..15453f65ec 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -19,7 +19,8 @@
"globals": {
"Blockly": false,
"trackJs": false,
- "jest": false
+ "jest": false,
+ "dataLayer": false
},
"plugins": [
"react"
diff --git a/gulp/build.js b/gulp/build.js
index 30ebffc806..d40b1cabbc 100644
--- a/gulp/build.js
+++ b/gulp/build.js
@@ -16,7 +16,6 @@ const getConfig = prefix => ({
binary_style_img: 'image/binary-style',
elevio_script :
'',
- gtm_head : ' ',
gtm_iframe:
' ',
});
diff --git a/src/botPage/view/blockly/customBlockly.js b/src/botPage/view/blockly/customBlockly.js
index 4e9319a389..db1fa80e52 100644
--- a/src/botPage/view/blockly/customBlockly.js
+++ b/src/botPage/view/blockly/customBlockly.js
@@ -1,4 +1,6 @@
-import { translate } from '../../../common/utils/tools';
+import GTM from '../../../common/gtm';
+import { translate, translateLangToLang } from '../../../common/i18n';
+import { getLanguage } from '../../../common/lang';
/* eslint-disable */
Blockly.WorkspaceAudio.prototype.preload = function() {};
@@ -334,3 +336,25 @@ Blockly.Input.prototype.attachShadowBlock = function(value, name, shadowBlockTyp
shadowBlock.initSvg();
shadowBlock.render();
};
+
+/**
+ * Expand or collapse the node on mouse click.
+ * @param {!goog.events.BrowserEvent} _e The browser event.
+ * @override
+ */
+Blockly.Toolbox.TreeNode.prototype.onClick_ = function(_e) {
+ // eslint-disable-next-line no-underscore-dangle
+ const blocklyCategoryName = translateLangToLang(_e.target.innerText, getLanguage(), 'en');
+ GTM.pushDataLayer({ event: 'Click Block Category', blocklyCategoryName });
+
+ // Expand icon.
+ if (this.hasChildren() && this.isUserCollapsible_) {
+ this.toggle();
+ this.select();
+ } else if (this.isSelected()) {
+ this.getTree().setSelectedItem(null);
+ } else {
+ this.select();
+ }
+ this.updateRow();
+};
diff --git a/src/botPage/view/blockly/index.js b/src/botPage/view/blockly/index.js
index f464a78d63..0636724381 100644
--- a/src/botPage/view/blockly/index.js
+++ b/src/botPage/view/blockly/index.js
@@ -21,6 +21,7 @@ import { translate, xml as translateXml } from '../../../common/i18n';
import { getLanguage } from '../../../common/lang';
import { observer as globalObserver } from '../../../common/utils/observer';
import { showDialog } from '../../bot/tools';
+import GTM from '../../../common/gtm';
const setBeforeUnload = off => {
if (off) {
@@ -232,6 +233,31 @@ export default class _Blockly {
},
trashcan: false,
});
+ workspace.addChangeListener(event => {
+ if (event.type === Blockly.Events.BLOCK_CREATE) {
+ event.ids.forEach(id => {
+ const block = workspace.getBlockById(id);
+ if (block) {
+ GTM.pushDataLayer({
+ event : 'Block Event',
+ blockEvent: event.type,
+ blockType : block.type,
+ });
+ }
+ });
+ } else if (event.type === Blockly.Events.BLOCK_DELETE) {
+ const dom = Blockly.Xml.textToDom(`
- {translate(['In the EU, financial products are offered by Binary Investments (Europe) Ltd., Mompalao Building, Suite 2, Tower Road, Msida MSD1825, Malta, regulated as a Category 3 Investment Services provider by the Malta Financial Services Authority ([_1]licence no. IS/70156[_2]).', ``, ''])} + {translate(['In the EU, financial products are offered by Binary Investments (Europe) Ltd., W Business Centre, Level 3, Triq Dun Karm, Birkirkara, BKR 9033, Malta, regulated as a Category 3 Investment Services provider by the Malta Financial Services Authority ([_1]licence no. IS/70156[_2]).', ``, ''])}
- {translate(['Outside the EU, financial products are offered by Binary (C.R.) S.A., 5th Floor, Building 6 Centro Ejecutivo La Sabana, Sabana Sur, San José, Costa Rica, Binary (V) Ltd, Govant Building, Port Vila, PO Box 1276, Vanuatu, regulated by the Vanuatu Financial Services Commission ([_1]view licence[_2]), Binary (BVI) Ltd, 2nd Floor, O’Neal Marketing Associates Building, Wickham’s Cay II, P.O. Box 3174, Road Town, Tortola VB1110, British Virgin Islands, regulated by the British Virgin Islands Financial Services Commission ([_3]licence no. SIBA/L/18/1114[_4]), and Binary (FX) Ltd., Lot No. F16, First Floor, Paragon Labuan, Jalan Tun Mustapha, 87000 Labuan, Malaysia, regulated by the Labuan Financial Services Authority to carry on a money-broking business ([_5]licence no. MB/18/0024[_6])', + {translate(['Outside the EU, financial products are offered by Binary (SVG) Ltd, Hinds Building, Kingstown, St. Vincent and the Grenadines; Binary (V) Ltd, Govant Building, Port Vila, PO Box 1276, Vanuatu, regulated by the Vanuatu Financial Services Commission ([_1]view licence[_2]); Binary (BVI) Ltd, Kingston Chambers, P.O. Box 173, Road Town, Tortola, British Virgin Islands, regulated by the British Virgin Islands Financial Services Commission ([_3]licence no. SIBA/L/18/1114[_4]); and Binary (FX) Ltd., Lot No. F16, First Floor, Paragon Labuan, Jalan Tun Mustapha, 87000 Labuan, Malaysia, regulated by the Labuan Financial Services Authority to carry on a money-broking business ([_5]licence no. MB/18/0024[_6]).', '', '', ``, '', ``, ''])}
- {translate(['This website’s services are not made available in certain countries such as the USA, Canada, Costa Rica, Hong Kong, Japan, or to persons under age 18.'])} + {translate(['This website\'s services are not made available in certain countries such as the USA, Canada, Hong Kong, Japan, or to persons under age 18.'])}
- {translate(['In the EU, financial products are offered by Binary Investments (Europe) Ltd., Mompalao Building, Suite 2, Tower Road, Msida MSD1825, Malta, licensed and regulated as a Category 3 Investment Services provider by the Malta Financial Services Authority (licence no. IS/70156).'])} + {translate(['In the EU, financial products are offered by Binary Investments (Europe) Ltd., W Business Centre, Level 3, Triq Dun Karm, Birkirkara, BKR 9033, Malta, licensed and regulated as a Category 3 Investment Services provider by the Malta Financial Services Authority (licence no. IS/70156).'])}
{translate(['In the Isle of Man and the UK, Volatility Indices are offered by Binary (IOM) Ltd., First Floor, Millennium House, Victoria Road, Douglas, IM2 4RW, Isle of Man, British Isles; licensed and regulated respectively by (1) the Gambling Supervision Commission in the Isle of Man (current licence issued on 31 August 2017) and by (2) the Gambling Commission in the UK (licence [_1]reference no: 39172[_2]).', '', ''])}
- {translate(['In the rest of the EU, Volatility Indices are offered by Binary (Europe) Ltd., Mompalao Building, Suite 2, Tower Road, Msida MSD1825, Malta; licensed and regulated by (1) the Malta Gaming Authority in Malta (licence no. MGA/B2C/102/2000 issued on 01 August 2018), for UK clients by (2) the UK Gambling Commission (licence [_1]reference no: 39495[_2]), and for Irish clients by (3) the Revenue Commissioners in Ireland (Remote Bookmaker\'s Licence no. 1010285 issued on 1 July 2017). View complete [_3]Regulatory Information[_2].', '', '', ``])} + {translate(['In the rest of the EU, Volatility Indices are offered by Binary (Europe) Ltd., W Business Centre, Level 3, Triq Dun Karm, Birkirkara, BKR 9033, Malta; licensed and regulated by (1) the Malta Gaming Authority in Malta (licence no. MGA/B2C/102/2000 issued on 01 August 2018), for UK clients by (2) the UK Gambling Commission (licence [_1]reference no: 39495[_2]), and for Irish clients by (3) the Revenue Commissioners in Ireland (Remote Bookmaker\'s Licence no. 1010285 issued on 1 July 2017). View complete [_3]Regulatory Information[_2].', '', '', ``])}
- {translate(['Binary.com is an award-winning online trading provider that helps its clients to trade on financial markets through binary options and CFDs. Trading binary options and CFDs on Volatility Indices is classified as a gambling activity. Remember that gambling can be addictive – please play responsibly. Learn more about [_1]Responsible Trading[_2]. Some products are not available in all countries. This website’s services are not made available in certain countries such as the USA, Canada, Costa Rica, Hong Kong, or to persons under age 18.', ``, ''])} + {translate(['Binary.com is an award-winning online trading provider that helps its clients to trade on financial markets through binary options and CFDs. Trading binary options and CFDs on Volatility Indices is classified as a gambling activity. Remember that gambling can be addictive – please play responsibly. Learn more about [_1]Responsible Trading[_2]. Some products are not available in all countries. This website\'s services are not made available in certain countries such as the USA, Canada, Hong Kong, or to persons under age 18.', ``, ''])}