Problem with piwik_action_name and PHP


(nicoferra) #1

Hello (sorry for my bad english),

if i put a php variable in “piwik_action_name”, i have no statistics with this variable in the vPage view.

Here is the end of my code in my php page

Thank you

  <?php  
   //$visitpage=$row['titre'];
   $visitpage='prout';
  
   } 
  
  ?>

</table>


 <?php

  mysql_free_result($result);

?>
<!-- Piwik -->
<a href="http://piwik.org" title="Google Analytics alternative" onclick="window.open(this.href);return(false);">
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://localhost/analyses/Piwik/piwik/" : "http://localhost/analyses/Piwik/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
piwik_action_name = “<?php echo $visitpage; ?>”;
piwik_idsite = 1;
piwik_url = pkBaseURL + "piwik.php";
piwik_log(piwik_action_name, piwik_idsite, piwik_url);
</script>
<object><noscript><p>Google Analytics alternative <img src="http://localhost/analyses/Piwik/piwik/piwik.php?idsite=1" style="border:0" alt=""/></p></noscript></object></a>
<!-- End Piwik Tag -->

</body>
</html>

(nicoferra) #2

Ok the problem was the quotes !

Bad syntax :
piwik_action_name = “<?php echo $visitpage; ?>”;

Good syntax :
piwik_action_name = ‘<?php echo $visitpage; ?>’;