[Advanced] Dynamic URL City/State Keyword Generator for AdWords

Status
Not open for further replies.

chatmasta

Well-known member
Jan 7, 2007
2,611
68
48
NYC
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... :D

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.
As you can see, this tool helps to deliver amazingly targeted longtail traffic to your sites. Convinced yet? Let's install this sucker!

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. :D
  • 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.
Installation Download attached cs_adwords.zip, extract it, edit config.php to reflect your database info, and upload it. Done.

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']) : ''; ?>
Now whenever you want to echo out the state, just use this code.

PHP:
<?=$state?>
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
  • 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. ;)
Enjoy!
 

Attachments

Last edited:


This is awesome, thanks! I dont have any arbitrage templates, what other kinds of scripts are you looking for?
 
Great work chatmasta. I'll send you a couple of templates tomorrow. I don't have access to my files today.
 
Like I said, I don't expect any payment. I'm just saying if you have anything you'd like to "trade" if you will, I would appreciate that. :)
 
WOW WOW WOW... your script is fuckin AMAZING. Thank you dude! If i can find something to trade i sure will!
 
I asked Jon to move this to affiliate marketing to hopefully attract more targeted attention...

Has anyone put this to good use for any campaigns yet? I haven't had time to really test it.
 
  • Like
Reactions: lucab
I used it for a campaign, but its not bringing traffic yet. I think its because my landing page SUCKS. so i am going to use it for something else and build a nice landind page
 
I used it for a campaign, but its not bringing traffic yet. I think its because my landing page SUCKS. so i am going to use it for something else and build a nice landind page

Why would your landing page be the reason for not gaining traffic? Are you getting impressions?
 
  • Like
Reactions: Jdog
I have been looking for something like this for a while. Thank you for adding to the community.

+rep
 
Capitals!!

I installed your script and it runs great but only after I got errors trying to install it. It was looking for "district of columbia.txt" but the actual file was called "District of Columbia.txt" As soon as I corrected the case it ran fine.

In your list it is spelled with Capitals but in your script it was looking for lower case.

Nice script

Thanks,

John
 
Critical update. See first post.

C'mon guys I know more of you need it than this. :D I want to see some results!
 
Sorry guys. Another update. I'm finding all these because I'm finally using it in my campaign. :D See first post.
 
chatmasta, this is pimp-ass! I'll echo the theme of this thread, thanks!

I've been doing this in Access (save me, no more M$) but I have some more data that might be useful.

At first glance, it seems like I may have more cities, there are 19,471 in here. I also have the actual population as of 2005. I've also 'categorized' them by size ranges like 100-200 (100k to 200k) up to 500+ and <3 (less than 3,000).

For some niches you may only want to target specific populations and this will help immensely.

Anyway, although it would need to be reworked a bit for this script, the data is attached. I split it into two files (states A-M, and N-Z) because of the upload size limit.

After I start playing around with this script I'll format it and repost it.


Enjoy....
 

Attachments

:)

I've got a lot on my plate at the moment so I can't work on scripts, but when I find the time I will definitely look into an even more helpful city/state keyword tool...

Jon's talked to me about making one exclusively for the WF tools section, so maybe I'll do that with the next one.
 
I've got a lot on my plate at the moment so I can't work on scripts...
Hell, I didn't post that data to put you to work, it's for public consumption.

Once I start digging into your script I'll integrate this population/size data and throw it back into this thread.
 
Ok, I tried to comment it as best I could but it's pretty messy. :D Just ask me if you don't know what something does.
 
Status
Not open for further replies.