Skip to content
Snippets Groups Projects

Issue-piwik_pro-3482342: Moved JS snippets to separate script files.

6 unresolved threads

Closes #3482342

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 1 (function (window, document, dataLayerName, id) {
2 window[dataLayerName] = window[dataLayerName] || [];
3 window[dataLayerName].push({ start: new Date().getTime(), event: 'stg.start' });
4
5 var scripts = document.getElementsByTagName('script')[0];
6 var tags = document.createElement('script');
7
8 function stgCreateCookie(a, b, c) {
9 var d = '';
10 if (c) {
11 var e = new Date();
12 e.setTime(e.getTime() + 24 * c * 60 * 60 * 1e3);
13 d = '; expires=' + e.toUTCString();
14 }
15 document.cookie = a + '=' + b + d + '; path=/';
2 window[dataLayerName] = window[dataLayerName] || [];
  • @anish.ir I think we can add these files to .eslintignore because the code is most likely directly coming from Piwik PRO and we don't need to modify it.

    It might be hard to maintain also because we don't know what changes they are making to the script and we might break something accidentally.

    I would add these Piwik PRO snippet scripts to .eslintignore and comment in the file that they are third party vendor code.

  • Hey @HeikkiY , I have solved the eslint errors, the errors were because of quotes, which are resolved now.

  • Please register or sign in to reply
  • added 1 commit

    • f4da4800 - Issue-piwik_pro-3482342: Solved the Eslint errors.

    Compare with previous version

  • added 1 commit

    • ad2a7d49 - Issue-piwik_pro-3482342: Solved the Eslint errors.

    Compare with previous version

  • Heikki Ylipaavalniemi
    Heikki Ylipaavalniemi @HeikkiY started a thread on an outdated change in commit f4da4800
  • 16 16 stgCreateCookie("stg_debug", isStgDebug ? 1 : "", isStgDebug ? 14 : -1);
    17 17
    18 var qP = [];
    18 const qP = [];
    19 19 if (dataLayerName !== "dataLayer") {
    20 qP.push("data_layer_name=" + dataLayerName);
    20 qP.push(`data_layer_name=${dataLayerName}`);
    21 21 }
    22 22 if (isStgDebug) {
    23 23 qP.push("stg_debug");
    24 24 }
    25 var qPString = qP.length > 0 ? "?" + qP.join("&") : "";
    26 document.write('<script src="' + id + ".sync.js" + qPString + '"></script>');
    25 const qPString = qP.length > 0 ? `?${qP.join("&")}` : "";
    26 document.write(`<script src="${id}.sync.js${qPString}"></script>`);
    27 27 })(window, document, "dataLayer", "https://your-piwik-pro-domain.com/");
  • Heikki Ylipaavalniemi
    Heikki Ylipaavalniemi @HeikkiY started a thread on an outdated change in commit f4da4800
  • 13 13 (window.location.href.match("stg_debug") ||
    14 14 document.cookie.match("stg_debug")) &&
    15 15 !window.location.href.match("stg_disable_debug");
    16 16 stgCreateCookie("stg_debug", isStgDebug ? 1 : "", isStgDebug ? 14 : -1);
    17 17
    18 var qP = [];
    18 const qP = [];
    19 19 if (dataLayerName !== "dataLayer") {
    20 qP.push("data_layer_name=" + dataLayerName);
    20 qP.push(`data_layer_name=${dataLayerName}`);
    21 21 }
    22 22 if (isStgDebug) {
    23 23 qP.push("stg_debug");
    24 24 }
    25 var qPString = qP.length > 0 ? "?" + qP.join("&") : "";
    26 document.write('<script src="' + id + ".sync.js" + qPString + '"></script>');
  • 1 piwik_pro_script:
  • added 1 commit

    • ee733935 - Issue-piwik_pro-3482342: Added version in libraries, removed hard-coded domain.

    Compare with previous version

  • added 1 commit

    • 455fddda - Issue-piwik_pro-3482342: Solved the Eslint quote error.

    Compare with previous version

  • 1 (function (window, document, dataLayerName, id) {
  • 1 (function (window, document, dataLayerName, id) {
    2 function stgCreateCookie(a, b, c) {
    Please register or sign in to reply
    Loading