How do I make it so the tracking code only runs once...and isn't triggered again on a refresh?
I searched but it seems almost always people are saying to use a database...but I was hoping to avoid that....is it possible?
Thanks开发者_JAVA百科
here is the solution for future searchers:
before <HTML>
put: <?php session_start(); ?>
Then do this:
<?php
if($_SESSION['check']!=1)
{
$_SESSION['check']=1;
echo '<div class="show">tracking code</div>';}
?>
There are a number of options available to accomplish this. You can use a flag variable in $_SESSION, you can use in-browser storage with HTML5, or a Javascript DB like http://taffydb.com/. $_SESSION flag variables would probably be the easiest since it doesn't require you to research much more than you already know.
Good luck!
精彩评论