Jump to content

Count views of CMS-pages


Recommended Posts

Is there any way to add a counter that lets me track how many visits my CMS pages have had?
I dont want it to be visualized in frontoffice but I would like to see in backoffice or similar how many times my customers have read my different cms pages.

Thanks in advance :)

Link to comment
Share on other sites

you can create SQL query in your SQL manager (advanced parameters > sql manager)

 

SELECT cl.meta_title as name, COUNT(*) AS visits FROM ps_connections c
INNER JOIN ps_page p ON p.id_object = c.id_page
INNER JOIN ps_page_type pt on p.id_page_type = pt.id_page_type
INNER JOIN ps_cms_lang cl ON p.id_object = cl.id_cms
WHERE pt.name='cms' and cl.id_lang = 1

(replace id_lang with id number of your language)

Link to comment
Share on other sites

  • 6 months later...

I did your solution but nothing had been shown me.

 

SQL   Report 
 
name     visits
                 0
 
my language ID is 1 (  cl.id_lang = 1)
even i remove the second conditional part (and cl.id_lang = 1) but nothing had been shown.
my prestashop version 1.6.0.14
 
---------------------------------------------------------
i have about 50 cms page that i can access them in front-end panel but
no one of the PS_CMS_LANG.id_CMS values are not in the PS_PAGE.id_object table.
what shoud i do???
Edited by imen sepahan (see edit history)
Link to comment
Share on other sites

finally I've modified this query like below:

 

 

SELECT 


   c.id_cms as pageID,
   cl.link_rewrite as CMSName,
   SUM(pv.counter) AS total 


FROM ps_page_viewed pv
LEFT JOIN ps_date_range dr ON pv.id_date_range = dr.id_date_range
LEFT JOIN ps_cms c ON pv.id_page = c.id_cms 
LEFT JOIN ps_cms_lang cl ON c.id_cms = cl.id_cms


 WHERE  cl.id_lang=1
GROUP BY pv.id_page
ORDER BY pageID
 
 
------------------------------------
but after I refresh my cms page or I viewed it on another client, the counter (ps_page_viewed.counter) never increased. ?!?!?!
 
I've had experience in Product viewer counter that this instruction is educated in this link: 
I implemented this  tutorial  for product viewer and it work correctly and perfectly but I want to implement this tutorial   for my CMS page.
what should i do???
Edited by imen sepahan (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
SELECT 
   c.id_cms as pageID,
   cl.link_rewrite as CMSName,
   SUM(pv.counter) AS total 
FROM ps_page_viewed pv
LEFT JOIN ps_date_range dr ON pv.id_date_range = dr.id_date_range
LEFT JOIN ps_cms c ON pv.id_page = c.id_cms 
LEFT JOIN ps_cms_lang cl ON c.id_cms = cl.id_cms
 WHERE  cl.id_lang=1
GROUP BY pv.id_page
ORDER BY pageID

 

Very nice @imen sepahan

Add this query to Prestashop MySQL Maganer (backoffice) and You will see views count of the cms pages :)

 

post-583420-0-26962400-1490179893.jpg

 

post-583420-0-26962400-1490179893_thumb.jpg

 

But how to show it in front? Still got "0 views"

Edited by PrestaShark (see edit history)
Link to comment
Share on other sites

thanks 'PrestaShark' 4 your replay.

 

 I can achieve to the number of each page  viewer and it had shown me the value instead of zero.

but there is a problem:

"after I refresh my cms page or I viewed it on another client, the counter (ps_page_viewed.counter) never increased. ?!?!?!"

it's still remain, without any changes.

 

after refreshing  your cms page , does your cms page counter increase?

Edited by imen sepahan (see edit history)
Link to comment
Share on other sites

  • 5 months later...

across implementaion of your suggestion finally i've stocked in this issue:

 

for every CMS page that I have in PS_PAGE table , the id_page set to 17(for every page!!- i have about 200 pages)
and also in PS_PAGE_VIEWED for all cms page the Id_page is set to 17 ,too.
 
I describe my issue in this topic completlly

 

please help me...

Edited by imen sepahan (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...