Skip to content

Heatmaps doesn't work for invariant content #28

@kasparboelkjeldsen

Description

@kasparboelkjeldsen

Which Umbraco Engage version are you using? (Please write the exact version, example: 13.2.0)

16.0.1

Which Umbraco version are you using? (Please write the exact version, example: 13.5.2)

16.2

Issue summary

When trying to view a heatmap for invariant content, the heatmap element fails and shows the "NoUrlsFound" rendering.

Specifics

In heatmap-screen.element.ts you fish out the document culture like so

this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, async (context) => {
      if (!context) return;

      this._documentUnique = context.getUnique()?.toString();
      this._documentCulture =
        context.splitView.getActiveVariants()[0]?.culture ?? undefined;

      await this.#getHeatmapPageVariants();
    });

Which will set documentCulture to "invariant" on invariant content

Later in heatmap.element.ts you set the default culture like so

this.consumeContext(UMB_APP_LANGUAGE_CONTEXT, (instance) => {
      this.observe(instance?.appDefaultLanguage, (value) => {
        this._defaultCulture = value?.unique;
      });
    });

Which on a default umbraco setup, with no vary by culture set up, will yield "en-US".

Finally in same file, it brings us to the bug

this._documentUrl = data?.[0].urls.find(
      (x) => x.culture === (this.#data?.culture ?? this._defaultCulture)
    )?.url;

Only getting out urls where effectively it's saying "invariant" === "en-US" which won't work.

Steps to reproduce

Install Umbraco Engage on a clean umbraco install with no vary by culture set up.
Generate heatmaps by browsing
Try to see the heatmaps

Expected result / actual result

I would expect the default culture to be set to "invariant" for conten that does not have vary by culture set to true.


This item has been added to our backlog AB#57866

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions