My adsense ad have a dedicated land page.
I want to show the content only to those who came through that ad.
The page is coded with PHP so I'm using $_SERVER['HTTP_REFERER'].
Two questions here:
Is there a better alternative to $_SERVER['HTTP_REFERER'] ?
To what strings/domains should I compare the referrer's domain (I'll handle extracting it)? I mean, I'm guessing that google has more than one domain they're using for the ads, or not? There's doubleclick.com.... any other domain? How can I check it, besides try/fail?
$_SERVER['HTTP_REFERER'] is the canonical way to determine where a click came from generally. There are more reliable (and complicated) methods for clicks within a site you fully control, but that's not much help for clicks from Google. Yes, it can be spoofed, and yes, it can be null, but as long as you're not targeting nuclear weapons based on that data, and you can handle null values gracefully, it should be good enough.
As for domains, you have to consider the international google domains, as well as all the google*.com domains.
I suggest adding a parameter on the link you give to Google. i.e. instead of yoursite.com/landing, do yoursite.com/landing?campaign=12.
If you are concerned that curious users will play with this parameter, the fix is simple-- redirect via a server 301 redirect when they hit that URL.
That is, if I request yoursite.com/landing?campaign=12, your server--before serving a page-- should log my visit to campaign 12 and redirect me to the plain url yoursite.com/landing. This has the added advantage that reloads won't increment your campaign hit count.
Yes, users could still mess with the original link if they are clever or curious enough to look at it before they click on it, but I think this is going to be far more effective than sniffing the referer.
Rather than trying to work out on your own how to measure your page views, you can consider using an existing system for that, like Google Analytics
Related
Ok. So I have websiteA.com. But I want everyone to go to websiteB.com. I work with websiteB.com, but can't use their name in advertisements. I want to have a redirect after .01 seconds from websiteA.com to websiteB.com. I did a 307 redirect. Easy as can be. Did exactly what I needed it to.
But when I put in the websiteA.com in my ads in Adwords, it came back disapproved because the final URL needs to be the same as the display URL (Google considers the final URL website B, due to the redirect).
I'm looking for some clever ideas. There has to be dozens of ways to execute what I need to with simple forms of redirects and this and that. But the main questions is how to make it work without Google noticing that it's a redirect.
(I have some experience here, but please try to keep the terminology to a minimum.)
:-)
Thanks!
Matt
I'm customizing the content of my site based on Google and Bing PPC campaigns. If a user clicks a PPC ad, they see certain content. If they come to the site via organic seach, they see different content. If they come direct, they see a third content.
It's working but not consistently; results are not behaving as expected, and often PPC ads will show the organic content.
I know HTTP_REFERER can't be trusted, so maybe this is causing the problem.
In any case, is there a better way to do this? Can I use Google Analytics and/or something in https://code.google.com/p/gapi-google-analytics-php-interface/ to reliably get the referring URL?
Thanks for any advice.
Showing different content based on whether the user clicked to your site from a search engine or typed the URL in directly is not possible without using $_SERVER, and even using $_SERVER is unreliable since it can easily be forged. However as far as I know, providing different content to search engines (also known as cloaking) is a quick way to get your site banned and/or penalized anyway. So I would avoid this at all costs.
For the CPC ad campaign, this is easy. Just set a different URL, eg http://www.yoursite.com/?cpc=adwords, then if $_GET['cpc'] is set, set a session variable and redirect them to the same page but without the $_GET parameter. Of course, session cookies could also be deleted/disabled, so even this is not 100% reliable.
I have strange requirement and I am not able to find dour whether it is feasible or not. Business wants to know outgoing activity from user. like from our website, where user goes out?
For example: user comes on my website (source): www.DummyTest123.com. After 5 mins of surfing, he goes out to (destination) www.Google.com or www.AnyOtherWebite.com.
How do I know can capture ( www.Google.com or www.AnyOtherWebite.com.) in my Database.
What are the classes or methods available in php to accomplish above requirement?
PS: http_referer will not work as in that , my website is destination.
Thanks
If you have outgoing links on your site to those places, you can change them to point to a page on your site that logs where they're going then redirects them to their destination.
Other than that - nope. That information isn't provided to you in any way.
It is not possible to check what website are people visited after they left yours unless they actually click on the link which is located on your website, and then get redirected.
This is only somewhat possible, and most likely not a great idea to implement. To answer your question, though, you could potentially have an outbound route on your site in which you direct all outbound links to:
http://www.yourdomain.com/outbound?r=www.google.com
There you can log the outbound activity to your hearts content.
There are, however, at least a couple drawbacks.
All outbound links will need to link to this URL. If you have a lot of existing content, it can take quite awhile to update all references to use the new link.
Users may trust your site less, as its not clear to them why you would not just link directly to the page they're trying to go to. What data are you collecting? Why are you collecting it? These are just some of the questions that may run through their minds.
Keep in mind, that this does nothing to log users who go up to the URL bar and physically type in a different URL, or open a new tab then close the one with your site.
At the moment, I'm working on a website that could use some extra user usability, so I want to launch a couple of modal windows to aid users on their first time visiting of a couple pages.
I want to check if it is a users time time viewing a specific page. I've read about how you can run into problems when using cookies to do this. They can be deleted, the user can use a different PC or device, etc.
Also, I want to check for multiple pages if it's their first time viewing, not only directly after login.
I'm guessing a good idea for this would be to make a separate table with the pages in it that I need and setting a boolean for it if it is viewed or not.
Would this be the best way going about doing this?
There isn't a highly reliable way of doing that:
You can use cookies, but as you said, they are not reliable, a user can change PC, delete cookies, change browser, etc.
You can try using an IP address, but that's also not reliable. If a user switches address (which can today happen as you walk down the street with your mobile phone) he'll see the page over and over again. Moreover, if some other user happens to stumble upon the IP address the first user used, he won't see your tour/tutorial.
What I can suggest you is that you use cookies to detect if the user is new, but don't automatically throw the help modules on him, but prompt him using an non-obstructive toolbar at the top or bottom (never a popup window or lightbox).
That way, you get most of the users (because many people use the same browser and computer and rarely delete all their cookies), and even if a user has deleted his cookies/he still won't be disturbed that much.
There is no reliable approach if user is not registered and logged in with her/his username & password.
As mentioned before, there is no reliable way of detecting users ( and detecting if the user visits the site the first time), I also recomend Madara Uchiha's aproach, also you colud use html5 local storage in addition to cookies, both are not 100% reliable
u can however try user recognition without relying on cookies or html5 storage, but this is extremly complicated, u dont want to do this.
Just to satisfy your curiosity about how to do this, check this epic answer on a related question:
User recognition without cookies or local storage
I think, as I believe, there is no way with no solution. I think, a possible way consists of some parameters which first to be said and and finally by considering those, we can be able to talk about possibilities and impossibilities.
My parameters are in the below;
talk about features of a webpage as "User Detection" and detail them
think about reactions (I mean being fast to click on any elements of a page or not) on a webpage
inspect elements
URL injection
other reactions like click on some parts as spots placed on the page
stay on that page up to a time defined for being and checking authorizing
and so some solutions like the ones above.
I want to create a private url as
http://domain.com/content.php?secret_token=XXXXX
Then, only visitors who have the exact URL (e.g. received by email) can see the page. We check the $_GET['secret_token'] before displaying the content.
My problem is that if by any chance search bots find the URL, they will simply index it and the URL will be public. Is there a practical method to avoid bot visits and subsequent index?
Possible But Unfavorable Methods:
Login system (e.g. by php session): But I do not want to offer user login.
Password-protected folder: The problem is as above.
Using Robots.txt: Many search engine bots do not respect it.
What you are talking about is security through obscurity. Its never a good idea. If you must, I would offer these thoughts:
Make the link expire
Lock the link to the C or D class of IPs that it was accessed from the first time
Have the page challenge the user with something like a logic question before forwarding to the real page with a time sensitive token (2 step process), and if the challenge fails send a 404 back so the crawler stops.
Try generating a 5-6 alphanumeric password and attach along with the email, so eventhough robots spider it , they need password to access the page. (Just an extra added safety measure)
If there is no link to it (including that the folder has no index
view), the robot won't find it
You could return a 404, if the token is wrong: This way, a robot (and who else doesn't have the token) will think, there is no such page
As long as you don't link to it, no spider will pick it up. And, since you don't want any password protection, the link is going to work for everyone. Consider disabling the secret key after it is used.
you only need to tell the search engines not to index /content.php, and search engines that honor robots.txt wont index any pages that start with /content.php.
Leaving the link unpublished will be ok in most circumstances...
...However, I will warn you that the prevalence of browser toolbars (Google and Yahoo come to mind) change the game. One company I worked for had pages from their intranet indexed in Google. You could search for the page, and a few results came up, but you couldn't access them unless you were inside our firewall or VPN'd in.
We figured the only way those links got propagated to Google had to be through the toolbar. (If anyone else has a better explanation, I'd love to hear it...) I've been out of that company a while now, so I don't know if they ever figured out definitively what happened there.
I know, strange but true...