Non-admin users see blank Analytics page in Confluence DC when Assets - Confluence Macro v4.0.2 is installed

XMLWordPrintable

    • 2
    • Severity 3 - Minor
    • 11

      Issue Summary

      Non-admin users who are granted access to Analytics for Confluence see a blank Analytics page (page flashes then clears/resets). Admin users can view analytics normally.
      Root cause is a JavaScript compatibility conflict between:

      • Analytics for Confluence plugin: com.addonengine.analytics
      • Assets - Confluence Macro plugin: com.riadalabs.confluence.plugins.insight-confluence v4.0.2

      For non-admin users, the Assets web resource (ifc-web-resources) loads late and removes/corrupts d3.selection.prototype.watchTransition after NVD3 adds it, causing chart rendering to crash.

      Steps to Reproduce

      1. Install Confluence Data Center (on-prem).
      2. Install/enable Analytics for Confluence (com.addonengine.analytics).
      3. Install/enable Assets - Confluence Macro (com.riadalabs.confluence.plugins.insight-confluence) v4.0.2.
      4. Create (or use) a non-admin user account.
      5. Add the non-admin user to the group that grants Analytics access in Confluence.
      6. Log in as the non-admin user and open the Analytics page (e.g., Space/Global Analytics view depending on configuration).

      Expected Results

      Non-admin users with Analytics permissions should be able to load the Analytics page and view charts/data normally (same behavior as admin users).

      Actual Results

      For non-admin users, the Analytics page:

      • loads briefly (flash), then becomes blank / resets,
      • while admin users continue to see Analytics normally.

      Backend calls are successful (confanalytics REST APIs return 200 OK with valid payload), but the UI crashes during chart rendering.

      (Observed in the browser console / bundled JS runtime error)

      Uncaught TypeError: fe.watchTransition is not a function  at batch.js:108:1303936

      Additional console message observed before the crash:

      The analytics client you provided doesn't support page events / track events

      Cluster/UI behavior correlates with web-resource bundle ordering:

      • Admin user bundle: Assets loads early → NVD3 adds watchTransition after → Analytics renders OK
      • Non-admin bundle: NVD3 adds watchTransition → Analytics initializes → Assets loads late and removes it → next render crashes

      Workaround

      1. Log in as Confluence Administrator
      2. Go to Admin → General Configuration → Custom HTML
      3. Scroll to "Body end" section
      4. Add the following code and click Save:
        <script>
        (function patchD3WatchTransition() {
            // Re-add watchTransition after Assets plugin may have corrupted it
            function patch() {
                if (typeof d3 !== 'undefined' && d3.selection && !d3.selection.prototype.watchTransition) {
                    d3.selection.prototype.watchTransition = function(renderWatch) {
                        var args = [this].concat([].slice.call(arguments, 1));
                        return renderWatch.transition.apply(renderWatch, args);
                    };
                }
            }
            // Patch immediately and again after WRM finishes loading all resources
            patch();
            if (typeof AJS !== 'undefined') {
                AJS.toInit(function() { patch(); setTimeout(patch, 500); setTimeout(patch, 2000); });
            }
        })();
        </script>
      5. Clear browser cache and reload the Analytics page as a non-admin user
      6. If page still shows blank on first load, refresh once — the patch timing may need one cycle

              Assignee:
              Unassigned
              Reporter:
              Shruthi Hebbal
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: