php - How can I pass a unique ID in a url to other pages on my site? -
client wants seek retargeting banner ads (using google adwords) , having maintain lead sources seperate. lead source id submitted form user fill out. want create unique id retargeting banners so: http://www.mysite.com/index.php/?id=12345 , pass id on other pages when end on form , submit it, can take id , submit form database track lead source (which associated id).
how can this?
hopefully not confusing! new php , things in general, help much appreciated.
edit: here code using.
index.php
<?php session_start(); include("includes/dynamicvars.php"); if (isset($_get['id'])) { $_session['leadid'] = 'microsite_retarget_cross'; $sitecode = $_session['leadid']; echo "retarget id set!"; } else { echo "default ppc id set!";} ?>
$sitecode defined 'microsite_ppc_cross' default in dynamicvars.php
then page2.php
<?php session_start(); include("includes/dynamicvars.php"); echo $sitecode; ?>
and still default $sitecode, instead of new 1 set on index.php.
right, when go index.php page, no longer has id in url, means if statement goes straight default ppc. should create session or utilize cookie let's know visitor same person. example:
if(isset($_session['visitor'])){ // nil }else{ // create session leadid if (isset($_get['id'])) { $_session['leadid'] = 'microsite_retarget_cross'; echo "retarget id set!"; } else { echo "default ppc id set!";} } // write session new visitor $_session['visitor'] = "currentvisitor"; }
php
No comments:
Post a Comment