Google Places API language=en returns results in other languages - google-maps-api-3

I'm sending the request like this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?&key=ENTER_YOUR_KEY_HERE&name=&types=restaurant&location=35.79067650569248,107.49634109437466&radius=521711.0&language=en
The query is in China.
and i'm getting results like this:
results: [
{
geometry: {
location: {
lat: 35.737293,
lng: 107.646029
}
},
icon: "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
id: "759bdf36fa8d5182c6cecb8839d21f5db691ab04",
name: "海底捞火锅西峰店",
place_id: "ChIJwQHr9-k9ZjYRkNpSDzYpfTo",
reference: "CnRrAAAAkM6HlYVwL2mO2sefdojOY7cqX9lQtA_OWt2pFzyGW7p6lj-1oSqFnX3q7_iJtDBGIcoRhqMxriUEXCD4Y8QaBZXhX_7IiqgO_2xHYHN9nWEKOYuPWmuj1V5nTy-D_w-im2OcZVoblKayGDuo2xJTiBIQ2DySEk1zgG1UDKHFnzBxTRoUqsR3fT9UOHrRwOj-hQZZygqxiWo",
scope: "GOOGLE",
types: [
"restaurant",
"food",
"point_of_interest",
"establishment"
],
vicinity: "Xifeng, Qingyang"
},
the name is in Chinese. is there something i can do?

MrUpsidown in the comments is correct: there's no English name for this place in Google's database, so returning the Chinese name Google does have is the best the Places API can do here.

Related

Custom metric/dimension not visible in GA4 DebugView on item/product-list level

We're trying to configure GA4 to gather same data that we have in UA.
The problem is that we cant see custom metrics data on item-level in DebugView.
In TagAssistant we can see that data is sent:
{
event: "purchase",
gtm: {uniqueEventId: 10, start: 1651XXX},
gtag: {
targets: {
G-XXX: {_ee: true, _uei: 3, _upi: 2},
UA-XXX: {
currency: "PLN",
country: "PL",
custom_map: {
dimension2: "referrer",
...
dimension13: "ecomm_totalvalue",
metric1: "metric1",
...
metric5: "metric5"
},
_uei: 4
},
AW-106XXX: {}
}
},
eventModel: {
transaction_id: "40XXX",
affiliation: "XXX",
value: "9.99",
currency: "PLN",
tax: "1.87",
shipping: "0",
coupon: "",
items: [
{
id: "670",
name: "Tusz Zamiennik T0711 do Epson (C13T07114010) (Czarny)",
brand: "XXX",
category: "Wkłady/Atramentowe/Zamienniki/Tusze/XXX -> Do:E" +
"pson",
quantity: 1,
price: "9.99",
coupon: "",
metric1: "9.99",
metric2: "9.99",
metric3: "9.99",
metric4: "9.99",
metric5: "9.99"
}
],
send_to: ""
}
}
However, on DebugView side we can see purchase event that:
contains all orginal parameters on event level (like transaction_id, shipping etc.)
contains all orginal parameters on item level (like item_id, quantity, etc.)
But our custom metrics are missing
In the other hand, we tried (with different event) push some custom-dumension data and:
they are visible on GA4 DebugView
we can create custom dimension in GA4 basing on this data and it works
I am thinking about:
Creating event-level custom metric to test if it will be passed to GA4 DebugView
Creating item-level custom dimension to test if it will be passed to GA4 DebugView
However, due to fact that GA requires 24h to make conclusions i decided to ask here for any sugestions why it is not working and what else may i test.

Need to get names of places in English in Google Place Autocomplete

We are using Google Places Autocomplete to fetch address of any location that the user enters. Now, if the user enters Phuket, then the address returned is in Thai language and not English.
I have tried setting language as English
I have tried these options
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&language=en">
</script>
I have also tried
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&language=en&region=GB">
</script>
Similarly for en-AU,en-GP and also language=en&region=AU.
But I still get the name in Thai language instead of English.
I want to see the names in English instead of Thai
I've tried to replicate the issue, using the sample code here, and I was able to get the formatted address of "Phuket, Thailand" which is in English:
See results below:
address_components: [
{
long_name: "Phuket",
short_name: "จ.ภูเก็ต",
types: [
"administrative_area_level_1",
"political"
]
},
{
long_name: "Thailand",
short_name: "TH",
types: [
"country",
"political"
]
}
],
formatted_address: "Phuket, Thailand",
place_id: "ChIJT1JixOIxUDARIbo9BoWayuk",
You can get either the long_name in address_components or the formatted_address which are in English.
Hope this helps!

How can I search Google Maps API and get multiple places?

I've been able to make requests to the Places API from Google Maps, but I always get one result.
For example, searching something like "The White House", or an actual street address, get one single result:
https://maps.googleapis.com/maps/api/place/findplacefromtext/json
?input=the%20white%20house
&inputtype=textquery
&fields=formatted_address,name,geometry
&key=API_KEY
response: {
candidates: [
{
formatted_address: "1600 Pennsylvania Ave NW, Washington, DC 20500, USA",
geometry: {
location: {
lat: 38.8976763,
lng: -77.0365298
},
viewport: {
northeast: {
lat: 38.90148105,
lng: -77.03520012010728
},
southwest: {
lat: 38.89640805000001,
lng: -77.03789977989273
}
}
},
name: "The White House"
}
],
status: "OK"
};
What if I want to find, to be cliche, all the Starbucks around me? (how to limit the search radius is a later question)
https://maps.googleapis.com/maps/api/place/findplacefromtext/json
?input=starbucks
&inputtype=textquery
&fields=formatted_address,name,geometry
&key=API_KEY
response: {
candidates: [],
status: "ZERO_RESULTS"
};
Some comments indicate that I should be getting a different response for my "Starbucks" search. Why aren't I?
You can try Nearby Search. Just please note that there is no way to constrain Nearby Search requests to only return specific fields.
Just look at the sample request below:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=38.8976763%2C-77.0365298&radius=50000&keyword=mcdonalds&key=YOUR_KEY
The response will give you all McDonalds store in this specific location 38.8976763,-77.0365298. You will also notice that there's a radius parameter of 50000 to return the place results.

Metalsmith-permalinks failing to add path to metadata

I'm using metalsmith-permalinks with the following settings:
.use(permalinks({
pattern: ':title',
linksets: [{
match: { collection: 'blogposts' },
pattern: 'blog/:title'
}, {
match: { collection: 'portfolioposts' },
pattern: 'portfolio/:title'
}]
}))
However, logging files in the relevant collections shows that path isn't being added to their metadata:
layout: 'subpage.hbs',
title: 'Blog Post',
date: 2016-08-16T00:00:00.000Z,
excerpt: 'This post has an excerpt',
tags: [ 'test', 'test-tag', 'a-third-tag' ],
contents: <>,
mode: '0644',
stats: {},
collection: [ 'blogposts' ]
Permalinks is being called before layouts, meaning it can't be the same issue found here, and – as seen in the log – other plugins are adding metadata successfully.
My full build order is:
.use(collections({}))
.use(tags({}))
.use(permalinks({}))
.use(dateFormatter({}))
.use(markdown({}))
.use(helpers({}))
.use(layouts({}))
.use(rename({}))
And I'm running Metalsmith directly in Gulp. Any help would be greatly appreciated.

Freebase MQL query - Get data by a social link

I'm having a hard time trying to get data about a person from Freebase using his social link - by a MQL query.
How could this be done?
Something like:
https://www.googleapis.com/freebase/v1/mqlread?query={
"*":[{}],
"/common/topic/social_media_presence":[{
"value":"http://twitter.com/JustinBieber"
}]
}
Those links are really stored as keys and the links are generated from templates with they key plugged in. You can see all the keys here: https://www.freebase.com/m/06w2sn5?keys=
A modified version of your query would be:
[{
"key": [{
"namespace": {
"id": "/authority/twitter"
},
"value": "JustinBieber"
}],
"*": [{}]
}]
You can do the same thing with other namespaces like /authority/facebook or /authority/musicbrainz as well as the various language wikipedias e.g. /wikipedia/en
I'm not sure how complete the coverage or currency of the social media info is though...

Resources