Does not count, despite code and visitors

Hello Together

Despite correct Matomo code, I do not see a visitor count.
What could be the reason for this.
I have received a few requests via web form, because the people have ordered something. So they were on the home page, but were not counted with Matomo, although on each page Matomo is set up.
Thanks for the answer

I can see that your Matomo setup is a bit odd. Instead of putting the JS snipped in the main page source, you put an iframe pointing at https://statistik.myservice4you.ch/counter.php. But that page takes nearly 40s for me to load and then only responds with Matomo snipped and is missing the rest of the required HTML5 structure (like <!DOCTYPE html>). That means that browsers are executing this page in quirks mode which I guess stopps the JS from being executed.

Also even if this would work, you are still just tracking the page inside the iFrame and not the actual website the user is visiting, so you won’t get data like the page URL or page title in Matomo

I have installed all updates in each case.
It would be great if Matomo works correctly again, because until last month it worked fine.
All the homepages I maintain are built the same way.
I have also created my own SEO entry tool, so that people without HTML knowledge can optimize the site for search engines. Each change is passed on to Google&Co.
I created an extra FTP account, so you can see the Matomo installation. https://example.com/matomoftp.txt
On this link you can see how the index file is built. https://example.com/matomostart.txt
Here you can see how my SEO tool looks like. https://example.com/testmetatag.php

So what do I have to change that Matomo counts again in my counter.php file?

It’s a real pity that no one here can help me.

As @Lukas previously wrote, your implementation is very strange…
The Matomo code should be added to pages, and not in <iframe>. Also I am not sure <iframe> included in the <head> tag is interpreted by the browser. Moreover, the <iframe> content is only JavaScript (host on another subdomain), that will query the other subdomain. Not sure the CSP authorizes that. On my browser, the source page of the iframe is never requested.

Out of subject:

"select * from hppage where (hpnr = $hpnr and pagelink = '$page1')"

is not safe at all: this allow SQL injection! (if $page1 is set to “'; truncate hppage;”, you may loose all your data)

1 Like

How do you make a page link without an iframe?
What is wrong with the “select * from hppage where (hpnr = $hpnr and pagelink = ‘$page1’)”. It is a normal SQL query. Where values are fetched from a database and so the MetaTags are placed on the page.

I don’t understand what you mean with “page link”…
The matomo bootstrap code has just to be placed instead of the iframe. In other words, replace the <iframe>...</iframe> by <script>...Matomo JavaScript code...</script>

See:

To exand on @heurteph-ei’s explaination regarding SQL injections:

Your query is

select * from hppage where (hpnr = $hpnr and pagelink = '$page1')

and $page1 is directly set to the value of a GET parameter. So by setting any arbitrary value as a GET parameter, one can (and sooner or later some automated script will or already has) e.g. set it to '); truncate hppage; --
making the SQL query:

select * from hppage where (hpnr = $hpnr and pagelink = ''); truncate hppage; --')

which then becomes interpreted by your SQL server as two commands separated by a ; with a comment at the end.

And the second command deletes all values in the hppage table.

And even worse if the SQL user also has access to other tables, anyone on the internet can not only delete and modify all data there, but also read it this way.

(To limit the impact a bit, I deleted all links to your site above)

1 Like

So how should I rewrite the SQL then?

Use either:

Or:

I have adapted my home page a little bit.
On the following link " https://1drv.ms/u/s!AqpPcfdS_Reg2R77SReptFoydXZo?e=g5xPoR " you can see the code of the start page, as well as the code of the statistics.
I have solved this with the select also differently.
Hope that now Matomo counts correctly again.

Is now the home page and statistics access better

So does it works fine now?

If you have looked at the last link, the start page is OK so that Matomo is working correctly.
So I can also adjust the other start pages of the other homepages to the version I sent in the last link.
According to the database, there are again a few entries for the month of August.