@Laul0 opened this Issue on May 12th 2020

Summary

The preview mode of Tag Manager container does not appear and the JavaScript seems not be the latest version neither.

Current behavior

Once connected to Tag Manager:

  1. Edit tag, trigger and/or variables
  2. Enable preview mode
  3. Add suffix URL to enable the preview mode on the target site
  4. No preview panel
  5. From Tag Manager, disable preview mode
  6. Publish the current changes as Dev environment
  7. Enable preview mode
  8. Add suffix URL to enable the preview mode on the target site
  9. No preview panel

Expected behavior

  1. Being able to enable the preview mode without publish changes in dev environment
  2. Once preview mode enable (with or without published changes), display the debug console from the target site

Additional information

Environment

  • Environment: Self-Hosted (Docker)
  • Behind a Nginx Proxy
  • Matomo version: 3.13.5
  • MySQL version: 5.7.24
  • PHP version: 7.3.17

What I have tried to do?

  • Clear proxy cache
  • Clear browser cache
  • Reboot docker
  • Add a version to the site script to force reload. Example
    g.src='https://target.domain.com/js/container_[container id].js?v=rev61-beta'
  • Change browser

Thank you for your help 🙌🏻

@tsteur commented on May 12th 2020 Member

Hi @Laul0 When you enable preview mode, maybe check if the fail for this container exists in $matomoDir/js folder when you activate preview mode. And ideally also check after enabling preview mode if the regular container starts with code like this:

image

I tried to reproduce but things are working fine here.

@Laul0 commented on May 12th 2020

I enable Preview mode with the browser developer tools opened but I don't see any error...

@Laul0 commented on May 12th 2020

System check seems good

Screen Shot 2020-05-11 at 23 12 05
@tsteur commented on May 12th 2020 Member

Be good to check the files on the filesystem directly whether there's eg a file like container_BTYwl0Vy_preview.js (assuming container ID is BTYwl0Vy) and whether the file container_BTYwl0Vy.js contains above mentioned code.

@Laul0 commented on May 12th 2020

When I am enabling the preview mode, the file container_[ID]_preview.js is created and when I disable the preview mode, this file is deleted

@Laul0 commented on May 12th 2020

Note: in my site, I added manually the URL of the preview script and the debug console appears

@tsteur commented on May 12th 2020 Member

Can you also check when preview mode is enabled if the file container_[ID].js starts with code like this?

image

@Laul0 commented on May 14th 2020

here, this is what I have once the preview mode enable:

/*!!
 * Matomo - free/libre analytics platform
 *
 * Matomo Tag Manager
 *
 * <a class='mention' href='https://github.com/link'>@link</a> https://matomo.org
 * <a class='mention' href='https://github.com/source'>@source</a> https://github.com/matomo-org/tag-manager/blob/master/js/piwik.js
 * <a class='mention' href='https://github.com/license'>@license</a> https://matomo.org/free-software/bsd/ BSD-3 Clause (also in js/LICENSE.txt)
 */
(function () {
    var b = document; var a = window;
    if ((document.cookie.indexOf('mtmPreview1_[ID]%3D1') !== -1 && window.location.search.indexOf('&mtmPreviewMode=0') === -1 && window.location.search.indexOf('?mtmPreviewMode=0') === -1) || window.location.search.indexOf('&mtmPreviewMode=[ID]') !== -1 || window.location.search.indexOf('?mtmPreviewMode=[ID]') !== -1) {

        var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
        g.type = 'text/javascript'; g.async = false; g.defer = false; g.src = 'https://myserver.com/js/container_[ID]_preview.js'; s.parentNode.insertBefore(g, s);
        return;
    }
@tsteur commented on May 14th 2020 Member

@Laul0 it's looking all good I would say. The preview mode should just appear as the code to enable it exists, and the preview file itself exists too. Feel free to send us a link to your page where we can try and reproduce it to hello at matomo.org

Powered by GitHub Issue Mirror