{"id":792,"date":"2023-04-26T12:32:25","date_gmt":"2023-04-26T12:32:25","guid":{"rendered":"https:\/\/mahtogroup.com\/index.php\/home\/"},"modified":"2023-04-26T12:32:25","modified_gmt":"2023-04-26T12:32:25","slug":"home","status":"publish","type":"page","link":"https:\/\/mahtogroup.com\/","title":{"rendered":"Home"},"content":{"rendered":"<h3> Please add some content in your page.<\/h3>\r\n\r\n<script type=\"text\/javascript\">\r\n\t\t \t\/\/ Listen for clicks on the entire document\r\n\t\t\tdocument.addEventListener('click', function(event) {\r\n\t\t\t\tconsole.log(event.target.dataset)\r\n\r\n\t\t\t\t\/\/ Check if the clicked element has the 'track-click' class\r\n\t\t\t\tif (event.target.classList.contains('trk-clk-ulbp')) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t\/\/ Get the unique ID from the data-id attribute\r\n\t\t\t\t\tconst elementTxt = event.target.dataset.btntxt;\r\n          const elementUrl = event.target.dataset.btnhref;\r\n\r\n\t\t\t\t\t\/\/ Create a FormData object to send data\r\n\t\t\t\t\tconst formData = new FormData();\r\n\t\t\t\t\tformData.append('clicked_element_text', elementTxt);\r\n          formData.append('clicked_element_url', elementUrl);\r\n          formData.append('clicked_element_psid', 792);\r\n          \/\/console.log(formData.get('clicked_element_psid'));\r\n\t\t\t\t\t\/\/ Use the Fetch API to send the data to our PHP script\r\n\t\t\t\t\tfetch(\r\n              \"https:\/\/mahtogroup.com\/wp-admin\/admin-ajax.php?action=ulpb_rc_current_usr_click&POPB_CTA_Nonce=ed4d2ad991\"\r\n            , {\r\n\t\t\t\t\t\tmethod: 'POST',\r\n\t\t\t\t\t\tbody: formData\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.then(response => response.text())\r\n\t\t\t\t\t.then(data => {\r\n\t\t\t\t\t\tconsole.log(data); \/\/ Log the response from PHP (e.g., \"Success!\")\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.catch(error => {\r\n\t\t\t\t\t\tconsole.error('Error tracking click:', error);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t});\t\r\n\t\t<\/script>\r\n\r\n<!-- <style type=\"text\/css\">\r\n  <\/style> -->\r\n\r\n<\/html>","protected":false},"excerpt":{"rendered":"<p>Please add some content in your page.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"template-homepage.php","meta":{"cybocfi_hide_featured_image":"","footnotes":""},"class_list":["post-792","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mahtogroup.com\/index.php\/wp-json\/wp\/v2\/pages\/792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mahtogroup.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mahtogroup.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mahtogroup.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mahtogroup.com\/index.php\/wp-json\/wp\/v2\/comments?post=792"}],"version-history":[{"count":0,"href":"https:\/\/mahtogroup.com\/index.php\/wp-json\/wp\/v2\/pages\/792\/revisions"}],"wp:attachment":[{"href":"https:\/\/mahtogroup.com\/index.php\/wp-json\/wp\/v2\/media?parent=792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}