I am calling the Google Analytics API (w/ e-commerce) to get a simple set of data:
Dimensions
ga:medium
ga:transactionId
Metrics
ga:transactionsThis should in theory give me 0 or 1, since the data is broken down by transactionId
What I'm assuming I will get is something like:
['organic','transaction_1000001','1']
['organic','transaction_1020001','1']
['organic','transaction_1000501','1']
['organic','transaction_1001001','1']
...
['email', 'transaction_1001001','1']
...
But instead, I don't get the ga:transactionId dimension. I only get results grouped by ga:medium:
['organic','1238']
['email','151']
...
I don't really care about the metric, it could be anything. What I need want is to get the medium with the transactionId.
So, is there a way to get a result set grouped by ga:medium and ga:transactionId? Why is the ga:transactionId dimension ignored?
I solved this issue. Hopefully this answer helps anyone facing this problem.
I was using the NodeJS api bindings. Turns out, the dimensions (and metrics) properties need to be strings. I was using an array.
The dimensions value needs to be specified like this:
ga:medium,ga:transactionId
So a simple dimensions.join(',') fixed it.
Related
Im using the "avoidareas" parameter to remove some points from the initial trip. This method worked a couple of months ago, but now it returns the same route as the initial trip, ignoring the "avoidareas" parameter.
Here is the exemple im working with:
"https://fleet.ls.hereapi.com/2/calculateroute.json?apiKey={YOUR API KEY}&mode=fastest;truck;traffic:enabled;¤cy=EUR&restTimes=EU&traverseGates=true&tollVehicleType=3&trailerType=2&trailersCount=1&length=13.6&width=2.4m&height=3m&limitedWeight=24000kg&legAttributes=li,-mn,sh&linkAttributes=wn,le,sh,-fc&mapMatchRadius=5000&ignoreWaypointVehicleRestriction=5000;0;all&departure=2022-09-08T16:00:00&waypoint0=40.613223,-3.2451044&waypoint1=39.919898,-8.634333&avoidareas41.6419,-5.16831;41.541900000000005,-5.06831"
Am i doing something wrong? Has something been updated?
The 'avoidAreas' feature works, but the request needs to be verified for the following:
the parameter name is in camelCase, so it should be 'avoidAreas', you are missing "=" sign right after avoidareas in your request url,
avoid area rectangle should be specified by latMax,lonMin;latMin,lonMax
A sample request looks like https://fleet.api.here.com/2/calculateroute.json?waypoint0=50.112698,8.675777&waypoint1=48.544180,9.662530&mode=fastest;truck;traffic:enabled&departure=2022-08-09T13:12:35&alternatives=0&weightPerAxle=3.25t&limitedWeight=7.5t&height=3.4m&width=2.5m&length=7.2m&trailersCount=1&avoidAreas=48.988757459020015,8.436328214242295;48.94714399157084,8.493687099461848
Thanks
/MS
I have a page which gets some queryparameters from another page. Just like this:
https://sampleurl.com?foo=bar&tomato=yes
I am trying to use google analytics through UTM parameters. And I append these parameters to the link as this:
https://sampleurl.com?foo=bar&tomato=yes&utm_source=facebook&utm_medium=post
My analytics team says that these don't work and UTM parameters should be positioned right after the base url like this:
https://sampleurl.com?utm_source=facebook&utm_medium=post&foo=bar&tomato=yes
I mean these are query parameters, positions of these should be irrelevant but I couldn't find any information about the subject saying that the parameter positions are relevant or irrelevant.
Are they relevant for Google?
It is a best practice but it is not relevant.
Here is a test that I carried out:
https://www.my-website.com/?utm_source=test1&utm_medium=test1¶m1=1¶m2=2
https://www.my-website.com/?param1=1¶m2=2&utm_source=test2&utm_medium=test2
The result in Google Analytics:
Below url is used for fetching analytics data related to firebase dynamic links:
https://firebasedynamiclinks.googleapis.com/v1/SHORT_DYNAMIC_LINK/linkStats?durationDays=DURATION
(Please note that the above url is an API that needs authentication/token. You can't open it in a browser. Also, SHORT_DYNAMIC_LINK and DURATION are just placeholders not actual parameter values.
The reason I have added a link is because my question is about the value of the placeholder - DURATION present in the link)
DURATION tells how many days(going backwards) worth data needs to be fetched.
My requirement is to fetch data from the start(when the dynamic link was created). So, what value should I set for durationDays to achieve that?
As a workaround I can set a big number(like 1000 days) but wanted to know a proper way.
Based on what I tried, the parameter durationDays must be present in the url, otherwise the request would return 400 INVALID ARGUMENT. Even setting DURATION values to 0 or -1 return a similar error.
Firebase Analytics API Doc: https://firebase.google.com/docs/reference/dynamic-links/analytics
I have the following script which is being used in a spreadsheet to calculate the driving distance between two cities or a city and a zip code of another city. It is being run for approximately 25 locations simultaneously. To better explain, I have cell B3 in which I enter a new city every time. The script is then used in cells adjacent to my 25 plant locations to calculate the distance from each of my plants to the variable city.
It uses google sheets built in mapping api and works on 80% of the calculations but returns "TypeError: Can Not Read Property "legs" from undefined. (line 16). The plants that it fails on vary with every new city so its not like it is for certain locations. It is almost like the api times out before it completes some of them. I split it into two separate scripts with a varied name and that worked for a day but then 20% fail again.
To make things slightly more odd, I have another script that sorts the plants based on closest distance to the variable address. When you sort the plants, even the ones with errors go to their correct location based on distance. So it is like the distance script is obtaining the correct disance but displaying the error anyways.
Clear as mud? Would love any input I could get on how to correct the issue or an alternate mapping api that could solve my problems.
function distancecalcone(origin,destination) {
var directions = Maps.newDirectionFinder()
//Set the Method of Transporation. The available "modes" are WALKING, DRIVING, BICYCLING, TRANSIT.
.setMode(Maps.DirectionFinder.Mode.DRIVING)
//Set the Orgin
.setOrigin(origin)
//Set the Destination
.setDestination(destination)
//Retrieve the Distance
.getDirections();
return directions.routes[0].legs[0].distance.value/1609.34;
}
Have you tried using a try-catch block around directions.routes[0].legs[0].distance.value ?
try{
return directions.routes[0].legs[0].distance.value/1609.34;
}
catch (e){
console.log("error",e)
}
or you could try something like this
alert(directions);
alert(directions.routes[0]);
alert(directions.routes[0].legs[0]);
alert(directions.routes[0].legs[0].distance);
alert(directions.routes[0].legs[0].distance.value);
and so on...to find out which one comes up as undefined the first. That might help you to debug the issue.
Enable Direction Api
1)Go to "google cloud platform"
2)go to "Api and services"
3)search for "direction api" and enable it
The directions service is subject to a quota and a rate limit. Check the return status before parsing the result.
For lots of distances (or at least more than 10), look at the DistanceMatrix.
I'm able to run the script from the Script editor, but not from spreadsheet. The error is "unable to read property legs" when the function is called from spreadsheet. But the property is in place when called from Script editor and contain correct values.
You probably need to use WEB API and have API KEY:
Google Apps Script - How to get driving distance from Maps for two points in spreadsheet
I have inferred from my searches that the URI for a Google Calendar feed that limits the date range should include timeMin and timeMax and should also include singleEvents and orderBy. This is the URI that I've constructed:
https://www.google.com/calendar/ical/myuserid#gmail.com/public/full?singleEvents=true&orderBy=startTime&timeMin=2014-01-01T00:00:00&timeMax=2018-03-24T23:59:59
Regardless of what query parameters I put after the projection value, I still get back all events dating from 8/2008 through whatever future dates I have in the calendar.
I really am "constructing" this based on very little knowledge. Can anyone set me straight, please?
It also took me quite some trials and errors to realize that offset is actually mandatory, not optional, as documented in
https://developers.google.com/google-apps/calendar/concepts
Try to add "Z" to the end of your URL:
https://www.google.com/calendar/ical/myuserid#gmail.com/public/full?singleEvents=true&orderBy=startTime&timeMin=2014-01-01T00:00:00Z&timeMax=2018-03-24T23:59:59Z
Mastoll, I think you are using calendar v3, is that right? You may try:
https://www.google.com/calendar/ical/myuserid#gmail.com/public/full?singleEvents=true&orderBy=startTime&start-min=2014-01-01T00:00:00&start-max=2018-03-24T23:59:59&
You can try using start-min and start-max instead of timeMin and timeMax. This is the parameter for calendar v2, I don't why, but v2 parameter works for public calendar. You can also add the futureevents=true parameter. For the details information for v2, please refer to the following:
https://developers.google.com/google-apps/calendar/v2/reference?hl=de&csw=1#Parameters