| | #1 |
| Active Warrior War Room Member Join Date: 2012
Posts: 31
Thanks: 26
Thanked 5 Times in 5 Posts
|
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 |
| |
| | #2 |
| HyperActive Warrior War Room Member Join Date: 2012 Location: Ohio, USA
Posts: 139
Thanks: 8
Thanked 35 Times in 31 Posts
|
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.
|
| | |
| |
| The Following User Says Thank You to dwoods For This Useful Post: |
| | #3 |
| HyperActive Warrior Join Date: 2012
Posts: 153
Thanks: 1
Thanked 7 Times in 7 Posts
|
Add this code in your header.php file and it'll do |
| |
| The Following User Says Thank You to boilingstocks For This Useful Post: |
| | #4 |
| Active Warrior War Room Member Join Date: 2012
Posts: 31
Thanks: 26
Thanked 5 Times in 5 Posts
|
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 |
| |
| | #5 |
| HyperActive Warrior Join Date: 2012
Posts: 153
Thanks: 1
Thanked 7 Times in 7 Posts
|
Just make use of Wordpress - child themes feature so that future updates don't erase your code and everything works fine !
|
| |
| The Following User Says Thank You to boilingstocks For This Useful Post: |
| | #6 | |
| Active Warrior War Room Member Join Date: 2012
Posts: 31
Thanks: 26
Thanked 5 Times in 5 Posts
|
Wordpress n00b here. ![]() Thanks a ton. Matt | |
| |
|
| Bookmarks |
| Tags |
| pages, query, string, wordpress |
| |