Zeichen32 / PiwikCustomOptOut

Create your own piwik opt-out iframe css styles
GNU General Public License v3.0
25 stars 10 forks source link

Compatibility with Matomo 3.13.0 ? #61

Closed Himra closed 4 years ago

Himra commented 4 years ago

Seems like the plugin doesn't work with this version. Re-installation does not fix the problem.

I need this useful plugin because I want to use my own font.

Does anyone run it with this version?

Himra commented 4 years ago

this is the content of the linked CSS file The font is in the same directory as the CSS file It always renders with Arial

@font-face {
    font-family: 'orkneylight';
    src: url('orkney-light-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

body{
    background:transparent;
    margin: 0;
    font-family: 'orkneylight', Arial;
    font-size: 1.1rem;
}
Zeichen32 commented 4 years ago

Ive checked the plugin with the latest matomo version and it works like expected. I think you has some other issues with your css styles.

Maybe you can check your generated html content, to see if everything is injected corrently.

Edit: Please be sure, you use the correct iframe uri with the correct site id.

Himra commented 4 years ago

Hello Zeichen32,

The CSS is correctly integrated and displayed in the source code, but it always uses the wrong font. Another CSS file in the same folder and with the same font integration works.

somehow strange

Zeichen32 commented 4 years ago

So it is a problem with your css code and not with the plugin. So we can close this issue? Maybe you can try to add the font style with a absolute uri.

Himra commented 4 years ago

It also occurs with absolute paths and only in this plugin. The same CSS will work fine in a normal CSS file in the same directory.

Himra commented 4 years ago

here is the link: https://stat.aurina.de/index.php?module=CoreAdminHome&action=optOut&idsite=1&language=de

Zeichen32 commented 4 years ago

Your webfont is not found by the browser: image

This is defintiv a problem with your css style and not with this plugin. Maybe it is a cross-site script / iframe problem.

The Browser Console Tab shows: "Access to font at 'https://dorfimker.de/assets/dorfimker/orkney-light-webfont.woff' from origin 'https://stat.aurina.de' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."

Himra commented 4 years ago

Thanks for your quick answer.

Why can the browser find the CSS and not the font, both files are in the same directory.

This definitely exceeds my knowledge. Can anyone describe how to solve this?

Zeichen32 commented 4 years ago

You need to configure your webserver to add a Allow-Origin Header when serving the font file. This is a security feature of modern browsern if you want to request between different domains / subdomains. https://www.codecademy.com/articles/what-is-cors

Himra commented 4 years ago

I copied the font into the Matomo directory and inserted the CSS script directly into the plugin. Now it works.

Thanks again for your help.

Zeichen32 commented 4 years ago

No problem, your welcome.