I'm trying to retrieve the web page content of Bing Images for a specific query.
I'm currently communicating with Bing through the following URL (in case of a sample foo search), from curl command line tool:
curl http://www.bing.com/images/search?q=foo
Since the safe search filter is enabled by default, I'd need to disable it.
How can I do that?
I know that direct API access would be preferable, but I need to bypass them and retrieve the entire web page.
I saw that from the web page, the safe search is disabled through Ajax calls.
What URL should I contact to make a search with safe search disabled?
The correct solution is to use the query parameter safeSearch=off, like
curl http://www.bing.com/images/search?q=foo&safeSearch=off
This is not documented anywhere I could find.
Add &adlt_set=off to the Bing Search url to close SafeSearch.
&adlt_set=moderate to filter adult images and videos but not text from your search results.
&adlt_set=Strict to filter out adult text, images, and videos from your search results.
The solution is simply to add &safesearch=off to the search URL.
Related
I have a webpage where it has its own search form that is using the "q" as the GET parameter, when a user try to use that search if there's no result found on that search, I will display the Google Custom Search and let them Google instead. However, when my URL is mydomain.com/?q=test , the Google Custom Search will autopopulate its search field as "test" and trigger the Google search result as well on the same webpage.
I prefer Google custom search not to be autopopulated because I am afraid if this break the adsense policies. But I can't avoid it, my webpage already been using the "q" as parameter, it's not an option for me to change to another parameter.
So does that break adsense policy, if so, how to avoid autopopulate ?
Thank
You can change the default query parameter from the control panel at Search features > Advanced > WebSearch Settings > Query Parameter Name.
See https://support.google.com/programmable-search/answer/3037004
I'd like to know how active are the users depending on the source/medium/campaign of the traffic they came from before sign up. I'm hitting wall when trying to get campaign/source/medium for the current visit from Google Analytics tracker in JS.
I found this tracker.get() method: https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference#get but they don't specify what are the possible values for 'fieldName'. I inspected the tracker object in Firebug and found out the screen attached screen grab:
Are these the only fields that I can query? Is reading any of the campaign fields possible? I understand that GA intends to be anonymous, but I figured this information is not really a secret...
If I can't retrieve this information from GA tracker, how would you approach this question? Should I set my own cookie whenever there's a visit with utm_ parameters and then read it if the visitor chooses to sign up?
I'm aware of this response: How do I extract Google Analytics campaign data from their cookie with Javascript? but a comment says parsing a cookie won't work for AdWords traffic..
I had to do something similar for a project. You need to think outside of the box to get this working. This will only work for cases where you put the campagn information in the url, for tagged url's.
1) On every page add server side code(php, asp .net) to parse the querystring and save the campagn/source/medium from the url in a session(or cookie)
2) Retrieve this information where you need it and process it.
You indeed need some custom javascript in order to achieve this.
I created an open source project for this that addresses the need quite simply:
https://github.com/ilkkapeltola/visitdata
Once you include the javascript library, you can call visitdata.get() and it'll return an object with things such as source, medium etc.
I use following sample URL pattern to search pattern on my web site.
http://www.mysite.com/search/someword
No query strings, just clean URL..
How can set this URL to google analytics site search system?
In theory, you should be able to create a profile filter to convert the URLs to use a query string. In practice, it turns out it's not possible, because Site Search gets processed before filters get processed.
Instead, what I've found that works is to just manipulate it in JavaScript so that you "fake" a query string directly from the browser.
Something like:
if(!location.pathname.match(/^\/search/)){
_gaq.push(["_trackPageview"]);
}
else{
_gaq.push(["_trackPageview", location.pathname.replace("/search/","/search?q=")]);
}
This would "fake" a query string with a key of q that you could then easily use the Site Search feature with.
After a user fills in my "new" user form on "example-one.com", the "create" controller creates the record in the db. Then it does a redirect_to to an external site "payment-checkout.com". I have setup the Google Analytics code on both sites.
Google provides two functions _link and _linkByPost for use to use in any links or forms that go to your external domains. The problem is the user is being redirected by the controller action outside of the view and I cant use those two javascript functions to pass on the relevent G.A. info - what do i do?
Can anyone help?
The way _link works is by passing the Google Analytics cookies from your first domain via a query string to your second domain. The second domain, if configured correctly, will accept those URL parameters and apply them as cookie values for the purposes of tracking.
So, it shouldn't be difficult for you to apply your own version of the _link function.
Specifically, the _link function passes the following cookies:
__utma, __utmb, __utmc, __utmx, __utmz, __utmv and __utmk
Into a query string as such: ?__utma=87278922.614105561.1288923931.1294376393.1298325957.6&__utmb=87278922.1.10.1298325957&__utmc=87278922&__utmx=-&__utmz=87278922.1288923931.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)&__utmv=-&__utmk=72493274
So, all you need to do to replicate the _link function is, before you apply the server side redirect, grab the cookie values, and apply them as a query string on the URL you're redirecting to.
Now, that's not the only thing you'll need to do to get this working. The Google Analytics configuration on the payment site will need to be configured with _setAllowLinker set to true, as well as potentially disabling the domain hash and setting a particular domain name for the tracking cookies; it depends on your configuration. You can find out more about that in Google Analytics Cross Domain Tracking Guide.
#yc's approach looks like the best bet but if that doesn't work, I would suggest having your controller redirect the user to a "temp" page on your site itself and show some text like "Checking out....Please wait..." and using Javascript trigger the call to the "_link" function to redirect the user to the "payment-checkout.com" (again using Javascript).
I assume you're also tracking the page the user returns to and want to measure how many users you lose in the process in between?
My knowledge of the Google Analytics API is fairly limited, so maybe there's a better solution, but you could consider rendering a page containing the GA code and triggering the _link() function from there?
It might also be possible to perform an AJAX call on submitting the form (maybe using remote_form_for) and handling the GA redirect in an RJS-response:
page << "_gaq.push(['_link', 'http://example.com/test.html']);"
However, I'm not sure how well that would fit into your application.
We're doing a simple implementation of Google Analytics on our ASP.NET with jQuery/AJAX web, and for most of it we just call _trackPageview and let Google do the rest.
We do a lot of data transfer in query strings, and recently, management became concerned that a lot of our data (such as product numbers) would be sent to Google. Without discussing whether that should be a concern:
Is it possible to use Google Analytics at all without sending the query string to Google's servers? I know how to filter it out from the actual reports, but I'm looking for a way to prevent it from being sent over the wire at all.
Yes, as Litso said, you can send a whatever you want as the pathname for a GA page-view, but you'll want to automate the process with JavaScript.
The following code will take the current URL's pathname (which excludes the query string) and uses it as the pagename value.
_gaq.push(['_trackPageview', location.pathname ]);
Or, conversely, if you're using the old _gat code,
pageTracker._trackPageview(location.pathname);
So, if your URL is http://example.com/path/to/page.html?supersecretinfo, it will get tracked in GA as /path/to/page.html
In stead of automatically tracking the pageview, you can use
pageTracker._trackPageview('/dir/example.html');
You'll have to dynamically strip out the parameters off of the url of each page. I'm not sure how to do that but it's definitely possible with JavaScript.