![]() |
Wordpress: query string GET and use on pages? Hey Warriors! I'm actually wondering if there is a NON-programming solution to this. I like to track all my ad campaigns, sometimes with more than one variable. Example: myawesomesite.com?CampaignID=Facebook&SubCampaignI D=ad03a I normally just create all my webpages from scratch, and in PHP its a simple matter of grabbing the variables from the query string, then just passing those arguments on through my site whenever I want to link to another page. example link: myawesomesite.com/about.php?CampaignID=<?= $CampaignID ?>&SubCampaignID=<?= $SubCampaignID ?> The idea is to ultimately capture this when the user completes a call to action of some sort, either placing an order or opting in to a list, etc., and then storing this info in my database. So, an opt-in form on my site would have a hidden field something like: <input type="hidden" name="CampaignID" value="<?= $CampaignID ?>" /> But, I'm just starting out with Wordpress, and am not sure if there is some kind of "built in" method for grabbing the query string variables and then "displaying" them on the page. For me, I'll just be using the variables in links or hidden fields on a form, but you get the idea. Any advice on built in WP funtions to handle this folks? A simple plugin? If you aren't using this method, how are all you Wordpress whiz's tracking your campaigns? I spent quite a bit of time googling, but came up short. Could be I am just not thinking the right keywords to be searching on though... Thanks! Matt |
Re: Wordpress: query string GET and use on pages? Yes you can do this easily by adding the same code you use for your raw php verison to the theme files in your wordpress installation. |
Re: Wordpress: query string GET and use on pages? Add this code in your header.php file and it'll do :) |
Re: Wordpress: query string GET and use on pages? Thanks folks. I thought it might be something like that, but was hoping to avoid modifying any of the theme files. Not sure, but I think potential future theme updates would overwrite that. (Not a huge deal, as its just a few lines of code, but still.) Thanks again. Matt |
Re: Wordpress: query string GET and use on pages? Just make use of Wordpress - child themes feature :) so that future updates don't erase your code and everything works fine ! |
Re: Wordpress: query string GET and use on pages? Quote:
Wordpress n00b here. :o Thanks a ton. Matt |
| All times are GMT -6. The time now is 10:31 AM. |