Is it possible to get Google Analytic goal value by date? - google-api

Google Analytics Management API goals endpoint. this is the link showing the goal endpoint I will be using to get a value. Is it possible for me to get the goal value broken up by date? I want to know the goal value for each day so I can create a line graph with accurate data. This endpoint is apart of the management API, but I know the core reporting API is more flexible with sorting by date. I would like to know if it is possible. If it is, please enlighten me!

Any reason you can't use the reporting API? You can use dimension=ga:date and metrics=ga:goalXXCompletions (ga:goal1Completions).
See the link to the query explorer report below:
https://ga-dev-tools.appspot.com/query-explorer/?start-date=2016-01-01&end-date=2016-03-27&metrics=ga%3Agoal1Completions&dimensions=ga%3Adate&samplingLevel=HIGHER_PRECISION&max-results=10000

You can query them together.
# get report data
query.list <- Init(start.date = "XXXXXX",
end.date = "XXXXXX",
dimensions = "ga:date",
metrics = "ga:goalXXValue",
table.id = "ga:XXXXX")

Related

How to get geolocation from Eircode/Post Code accurately

I am trying to get latitude and longitude from Ireland Eircode by using google API but I am not getting data from some postcodes given below:
A96X7F2
E45XD68
When I am trying to get data from this, It's returning status ZERO_RESULTS
https://maps.googleapis.com/maps/api/geocode/json?address=A96X7F2&key=API_KEY
Note: In most cases, I am getting data by using this API.
Try specifying the region:
https://maps.googleapis.com/maps/api/geocode/json?address=A96X7F2&region=ie&key=API_KEY
Issues with postcodes are discussed on their issue tracker here:
https://issuetracker.google.com/issues/73030863?pli=1
They say in that link that for best results use region or component filtering. [Both are ways to specify region, but the former is a hint, the latter is a filter.]

How do I use capture groups in Regular Expressions in Bot Composer

I am attempting to build a Microsoft Teams bot using the Bot Framework Composer. What I would like to do is create an integration with ServiceNow. The goal would be that if anyone posts a record number (ex. REQ0123456, INC0123456, KB0123456) into the group or direct chat (with the bot), the bot would look up that record and provide a card or a short summary of the record to the chat.
To avoid creating a completely separate intent for each record type, I was hoping to use RegEx to gather the match into 2 capture groups; one for the tbl_code and one for the number.
Here is the entry for the user input:
> add some example phrases to trigger this intent:
- look up {conversation.sn_record.tbl_code=REQ}{conversation.sn_record.number=0123456}
- lookup {conversation.sn_record.tbl_code=REQ}{conversation.sn_record.number=0123456}
- {conversation.sn_record.tbl_code=REQ}{conversation.sn_record.number=0123456}
- lu {conversation.sn_record.tbl_code=REQ}{conversation.sn_record.number=0123456}
> entity definitions:
# regex sn_record tbl_code, number = /([a-z]{2,4})([0-9]{7})/mi
The Issue I'm Having
I don't know how to get the values back from the individual capture groups. I would like to have them separate so that I can determine which table needs to be queried. I could probably just use the entire match and the search API in ServiceNow for the whole record string, but I would still like to know how to use capture group values.
I'm currently using turn.recognized.text, but I don't think this is the best method for what I'm looking to do. This returns the entire regex match.
I'm very new to this framework, so please be gentle. :) Let me know if there is more information I can provide.
Thanks all.
Best Regards,
Josh
I was able to figure this one out using the examples in the ToDosSample bot.
The answer was to use named capture groups and then add them to a dialog property to use in the corresponding dialog.
For reference here are the changes I had to make:
New Regex
(?<sn_record>(?<tbl_code>[a-z]{2,4})(?<numbers>[0-9]{7}))
New Dialog Properties
dialog.sn_record = #sn_record
dialog.sn_tbl_code = #tbl_code
dialog.sn_numbers = #numbers
New response
- Okay, looking up ${dialog.sn_tbl_code}${dialog.sn_numbers}

Youtube Api no result issue

I'm trying to use Youtube Api V3 to get documentaries videos, unfortunately I can't get any results for many searched keys.
Is there any advanced configuration I can use to get more results or is there any alternative API(s) ?
this is my query
https://www.googleapis.com/youtube/v3/search?part=snippet&q=alien&type=video&videoCategoryId=35
First and foremost make sure you have an API_KEY. Follow link for details, then go to developer console to get one.
Then your request URL should look like this.
var API_KEY = "your api key";
var channelID = "The channel id u wan to pull";
var result = 30 // Limit the number of videos
`https://www.googleapis.com/youtube/v3/search?key=${API_KEY}&channelId=${channelID}&part=snippet,id&order=date&maxResults=${result}`
With an API key, I also pulled 0 results for 'alien' in the Documentary category. Perhaps there aren't any.

How to structure Shopify data into a Firestore collection that can be queried efficiently

The Background
In an attempt to build some back-end services for my e-commerce (Shopify based) site I have set up a Firestore trigger that writes order details with every new order created which is updated by a web hook POST function provided by Shopify - (orders/Create webhook).
My current cloud function -
exports.saveOrderDetails = functions.https.onRequest((req, res) => {
var docRef = db.collection('orders').doc(req.body.name);
const details = req.body;
var setData = docRef.set(req.body).then( a =>{
res.status(200).send();
});
});
Which is able to capture the data from the webhook and store it in the order number's "name" document within my "orders" collection. This is how it looks in Firestore:
My question is - with the help of body-parser (already parsing out "name" which is represented as #9999 in my screenshot, to set my document name value) - how could I improve my cloud function to handle storing this webhook POST in a better data structure for Firestore and to query it later?
After reviewing the comments on this question, I moved this question over to Firebase-Talk and it appears the feature I am attempting here would be close to what is known as "collection group queries" and was informed I should adjust my data model approach since this feature is currently still on the road map - and perhaps look into the Firestore REST API as suggested by #jason-berryman
Besides the REST APi, #frank-van-puffelen made a great suggestion to look into working with Arrays, Lists, Sets for Firebase/Firestore
Another approach that could mitigate this in my scenario is to have my HTTP Firestore cloud trigger have multiple parsing arguments that create top more top level documents - however this could cause a point of scaling failure or an increase of cost factor due to putting more parsing processing logic in my cloud function and adding additional latency...
I will mark my question as answered for the time being to hopefully help others to understand how to work with documents in a single collection in Firestore and not attempt to query groups of collections before they get too far into modelling and need to restructure their app.

Find exhaustive list of restaurants around a location within a specified radius in android

I am working on an Android App. I want to get list of all restaurant around me within a specified radius(let say 5 miles). I tried using Google places API and it works, however it limits the number results returned to 20, what if there are more than 20 restaurant in that radius around me. How do I get an exhaustive list of all the restaurants? What is the best way to do this? Is there something other than Google Places API that I can use? Thanks for your help in advance.
If you want to do it server side you can use this guy's class :
http://andrenosalsky.com/blog/2011/google-places-api-php-class/
and you have to get an api key as it is explaned here :
http://code.google.com/intl/fr/apis/maps/documentation/places/
then you can send data in JSON format to your Android

Resources