Kentico / xperience-by-kentico-tag-manager

Enabling marketers to include prebuilt and custom tags into a website channel. Prebuilt are GTM, GA4, VWO, Intercom, MS Clarity
MIT License
2 stars 1 forks source link

Bug: Tag Manager client js script does not load correctly for most pages #15

Closed seangwright closed 2 months ago

seangwright commented 3 months ago

Brief bug description

The Kentico Community Portal is using Tag Manager v2.0.0

The ktc-tagmanager.js script loads fine on some pages, but 404's on others because it is not being loaded from the root of the site.

Repro steps

  1. Open a browser at https://community.kentico.com/blog
  2. Open dev tools and reload the page to see ktc-tagmanager.js is correctly loaded
  3. Click on a blog post in the list and notice that ktc-tagmanager.js does not download and results in a 404
  4. See that the URL the script is loaded from is https://community.kentico.com/blog/_content/Kentico.Xperience.TagManager/js/ktc-tagmanager.js and not https://community.kentico.com/_content/Kentico.Xperience.TagManager/js/ktc-tagmanager.js

Expected behavior

The tag manager script loads correctly on every page.

It should not be loading from a relative path ./ (as seen in the screenshot below).

None of Xperience's static assets load from a relative path like this.

Test environment

Screenshots

image

image

liparova commented 3 months ago

Thank you for bringing this to our attention. We will investigate and keep you informed of our progress.

mrutter commented 3 months ago

Hello everybody. Same issue here. It appears to happen for nested URL, that's when exists an additional path before /_content/.

Right now, we were able to find a workaround to this issue by working on URL Rewrite (assuming we have IIS with URL Rewrite Module installed) and adding the following rule:

    <rule name="Rewrite Kentico TagManager" stopProcessing="true">
        <match url="^.+\/_content\/Kentico(.+)$" />
        <action type="Rewrite" url="/_content/Kentico{R:1}" appendQueryString="false" redirectType="Permanent" />
    </rule>

Thank you.

fialafilip commented 3 months ago

Hi @seangwright , @mrutter , it has been fixed and released in v2.0.1. https://github.com/Kentico/xperience-by-kentico-tag-manager/releases