UPDATE 5/4 - CRITICAL (bugfix) - destination URL was not formatted properly and didn't actually exist. this ruined the whole point of the script. attachment needs to be redownloaded.
UPDATE 5/4 - CRITICAL (bugfix) - now echoes correct campaign name, rather than "campaign" - attachment needs to be redownloaded (after only 41 downloads - cmon guys!)
UPDATE 4/29 - (bugfix) changed .htaccess rules
You guys will love this...
Last week I posted a tool that in combination with my city/state database outputted a keyword list for your PPC campaigns. As promised, I have completely rewritten the script and it is improved in every way imaginable. It took a ton of time and 737 lines of confusing PHP, but its 110% worth it! :bowdown:
Features
What You Will Need
Configuring Your Site
Now that you can set up your ad campaigns, you need to have your site configured to accept the dynamic URLs. Make sure the page you are sending users to is PHP, and put this at the top.
Now whenever you want to echo out the state, just use this code.
Now, open your favorite text editor and create a file named .htaccess. In it, write the following:
[codeDirectoryIndex index.php
RewriteEngine On
RewriteRule ^([^/.]+)/?$ index.php?state=$1 [L][/code]Upload the file to the directory that your ad's page is in. Make sure you do so in binary mode (most FTP clients are smart enough to do this on their own by now).
End Notes
UPDATE 5/4 - CRITICAL (bugfix) - now echoes correct campaign name, rather than "campaign" - attachment needs to be redownloaded (after only 41 downloads - cmon guys!)
UPDATE 4/29 - (bugfix) changed .htaccess rules
You guys will love this...

Last week I posted a tool that in combination with my city/state database outputted a keyword list for your PPC campaigns. As promised, I have completely rewritten the script and it is improved in every way imaginable. It took a ton of time and 737 lines of confusing PHP, but its 110% worth it! :bowdown:
Features
- Longtail. Creates giant keyword list consisting of every city and state in the United States combined with your keywords.
- Custom display URLs. Each keyword has a custom display URL based on the state its in. For instance, if the user searches "Los Angeles Malls" they will see the display URL "your-site.com/California."
- Custom destination URLs. Each ad will send the user to the same as its display URL. With a simple line of .htaccess, this will enable you to have a $state variable on your pages so you can easily customize your content.
What You Will Need
- AdWords Desktop Editor. Download it here. The keyword lists are designed specifically for this editor, and that is the only way they will work.
- Installed City/State Database. Follow the instructions in the original post to install this. Don't install the tool though, that's what this is for.
- PHP/MySQL on a Linux/Apache Server. This tool should work with PHP 4.3+, which is installed on almost all servers now-a-days. If you do not have a compatible server, I recommend Hostgator (non aff) for cheap hosting.
- mod_rewrite installed. To integrate the dynamic URLs with your site, mod_rewrite is required.
Configuring Your Site
Now that you can set up your ad campaigns, you need to have your site configured to accept the dynamic URLs. Make sure the page you are sending users to is PHP, and put this at the top.
PHP:
<?php $state = (!empty($_GET['state'])) ? str_replace('WashingtonDC', 'Washington D.C.', $_GET['state']) : ''; ?>
PHP:
<?=$state?>
[codeDirectoryIndex index.php
RewriteEngine On
RewriteRule ^([^/.]+)/?$ index.php?state=$1 [L][/code]Upload the file to the directory that your ad's page is in. Make sure you do so in binary mode (most FTP clients are smart enough to do this on their own by now).
End Notes
- Bugs. If you find any bugs, just let me know and I will do my best to fix them.
- Improvements. Feel free to improve upon the script as you please. However, if you do, kindly post it here.
- Payment. I don't expect any kind of payment for this script, but it would be cool if you returned the favor and shared some of your scripts. I could use arbitrage templates too.
Attachments
Last edited: