prestalearn Posted August 18, 2016 Share Posted August 18, 2016 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 More sharing options...
vekia Posted August 19, 2016 Share Posted August 19, 2016 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 More sharing options...
imen sepahan Posted February 27, 2017 Share Posted February 27, 2017 (edited) 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 February 27, 2017 by imen sepahan (see edit history) Link to comment Share on other sites More sharing options...
imen sepahan Posted March 1, 2017 Share Posted March 1, 2017 (edited) 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: https://mypresta.eu/en/art/developer/product-page-visits-counter.html (by Milosz Myszczuk) 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 March 1, 2017 by imen sepahan (see edit history) 1 Link to comment Share on other sites More sharing options...
PrestaShark Posted March 22, 2017 Share Posted March 22, 2017 (edited) 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 But how to show it in front? Still got "0 views" Edited March 22, 2017 by PrestaShark (see edit history) Link to comment Share on other sites More sharing options...
imen sepahan Posted March 26, 2017 Share Posted March 26, 2017 (edited) 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 March 26, 2017 by imen sepahan (see edit history) Link to comment Share on other sites More sharing options...
imen sepahan Posted September 25, 2017 Share Posted September 25, 2017 (edited) 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 September 25, 2017 by imen sepahan (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now