What is the time range for the data returned by the Ads API keywordstats method? Is it simply the sum of the last 7 days?
Documentation says, that it's for the last 7 days, not including the current day.
Related
I need to create a recurrence in Power Automate so that it only runs in the last 5 working days of the month. I can't use a generic rule because months like February are different.
What I have done so far was using a similar recurrence that finds the last working day of the month but need help with optimising it for the last 5 working days instead.
The logic is that the flow runs every day and looks at the first day of the next month, then comes backwards to find the first working day and excludes Monday-Sunday. however, I need it to find the last 5 working days instead of 1.
Also the functions used are like this:
startOfMonth(addToTime(variables('Date'),1,'Month'))
addDays(variables('DateCountDown'),-1)
dayOfWeek(variables('DateCountDown'))
#and(not(equals(variables('DayOfWeek'), 0)), not(equals(variables('DayOfWeek'), 6)))
addDays(variables('DateCountDown'), -1)
dayOfWeek(variables('DateCountDown'))
disclaimer: I am not a pro user of power automate and found this flow in an old GitHub repository (written by Michael Ziemba) - thanks all for your help.
in response to teylin:
I get today (as before)
I get first day of next month (as before)
I go 7 days down now > addDays(variables('DateCountDown'),-7)
I initialize a variable to find week day > dayOfWeek(variables('DateCountDown'))
then varCounter variable as you said (varCounter > integer > 1)
then DO UNTIL loop until varCounter = 7
inside the loop I have 3 conditions: day of week <> 0 , dayof week <> 6 and formatDateTime(variables('DateCountDown'), 'dd-MM-yyyy') = formatDateTime(variables('Date'), 'dd-MM-yyyy') (to check today)
then trigger my stuff if yes,
increment varCounter by 1
Don't overthink this. Conceptually:
Get the first day of the next month (you already know how to do this)
get DayX by subtracting 7 from that date (you already do this with 1, now do it with 7)
By definition, 2 of the seven days between that DayX and the next month will be on a weekend. So, next, you start a loop that runs 7 times. Inside the loop, you have these actions:
add a condition with the following two checks
check if DayX is a weekday (you already know how to do this) AND
check if DayX is = today
In the Yes branch of the condition run the steps that you want to run on the last 5 weekdays, in the No branch do nothing
below the condition step, increment DayX by one day
loop
For the loop, first initialise a counter variable to the value 1. Add a Do Until action and set it to run until the counter is greater than 7. Inside the loop, do your calculations and your condition etc. As the last step of the loop, increment the counter variable by 1.
I am at a loss, i looked around the internet and stackoverflow but every so called solution is giving either errors or plainly don't work.
I have the following setup.
4 fields (setup in date dd-mm-yyyy, hour hh:mm:ss) seconds are not important.
start date : 7-1-2020
start hour : 23:30:00
end date : 8-1-2020
end hour : 03:50:00
What i want to happen is to calculate the diffrence in 'hours, minutes' between the end and the start date, hour. But when I calculate and change the end date to lets say 09-01-2020 it does not count the extra 24h at all.
Use Text format:
=text(A3-A1+A4-A2,"[H]:MM")
You need to format the time difference as a duration using the custom format
[h]:mm
for hours and minutes
or
[h]
for whole hours.
There are some good notes on how it works in Excel here and as far as I can tell from testing it Google Sheets is the same.
Alternatively, if I read your question as wanting to drop the minutes and seconds from the times before doing the calculation, you could use
=(B3-B1)*24+hour(B4)-hour(B2)
and just format the result as a normal number.
After alot of fiddeling and this post i came to the conclusion that the main issue was not laying within the mathematical but within the format of the cell.
By default all time values in sheets are 24h max.
So the basic formula =start - end
The time format needed should be
more date time format
elapsed hours : elapsed minutes
apply
Now you should see the correct elapsed hours and minutes
my issue is that I want to be able to get two time stamps and compare if the second (later taken) one is less than 59 minutes away from the first one.
Following this thread Compare two dates with JavaScript
the date object may do the job.
but first thing i am not happy with is that it takes the time from my system.
is it possible to get the time from some public server or something?
cause there always is a chance that the system clock gets manipulated within the time stamps, so that would be too unreliable.
some outside source would be great.
then i am not too sure how to get the difference between 2 times (using 2 date objects).
many issue that may pop up:
time being something like 3:59 and 6:12
so just comparing minutes would give the wrong idea.
so we consider hours too.
biut there the issue with the modulo 24.
day 3 23:59 and day 4 0:33 wouldnt be viewed proper either.
so including days too.
then the modulo 30 thing, even though that on top changes month for month.
so month and year to be included as well.
so we would need the whole date, everything from current year to second (because second would be nice too, for precision)
and comparing them would require tons of if clauses for year, month, etc.
do the date objects have some predfeined date comparision function that actually keeps all these things in mind (havent even mentioned leap years yet, have I)?
time would be very important cause exactly at the 59 minutes mark (+-max 5 seconds wouldnt matter but getting rmeitely close to 60 is forbidden)
a certain function would have to be used that without fail closes a website.
script opens website at mark 0 min, does some stuff rinse and repeat style and closes page at 59 min mark.
checking the time like every few seconds would be smart.
Any good ideas how to implement such a time comparision that doesnt take too more computer power yet is efficient as in new month starting and stuff doesnt mess it up?
You can compare the two Date times, but when creating a date time there is a parameter of DateTime(value) which you can use.
You can use this API to get the current UTC time which returns a example JSON array like this:
{
"$id":"1",
"currentDateTime":"2019-11-09T21:12Z",
"utcOffset":"00:00:00",
"isDayLightSavingsTime":false,
"dayOfTheWeek":"Saturday",
"timeZoneName":"UTC",
"currentFileTime":132178075626292927,
"ordinalDate":"2019-313",
"serviceResponse":null
}
So you can use either the currentFileTime or the currentDateTime return from that API to construct your date object.
Example:
const date1 = new Date('2019-11-09T21:12Z') // time when I started writing this answer
const date2 = new Date('2019-11-09T21:16Z') // time when I finished writing this answer
const diff = new Date(date2-date1)
console.log(diff.toTimeString()) // time it took me to write this
Please keep in mind that due to network speeds, the time API will be a little bit off (by a few milliseconds)
I'm very new to APIs, Java and all this things.
I Googled and over-googled things about the Google Analytics API and found very few answers. So I thought I'd post my question here.
The ga:avgSessionDuration returns the average sessions duration on my sites. But it returns in seconds and miliseconds. I want that number divided by 60 so I'll se minutes (as I see it on the Google Analytics website). But I have no clue how to do that and found no answer on Google.
Here is my code:
'dimensions': 'ga:yearMonth',
'metrics': 'ga:users,ga:pageviews,ga:avgSessionDuration',
'start-date': '2014-01-02',
'end-date': 'today',
'max-results': '12',
'sort': '-ga:yearMonth',
The return info is:
Month of Year Users Pageviews Avg. Session Duration
201505 18 25 27.894736842105264
201504 475 685 38.3062381852552
Another thing I hate is that the Months are printed out as "201505" instead of "May 2015".
Cheers. :)
As you can see from the documentation:
ga:avgSessionDuration
Web View Name: Avg. Session Duration The
average duration of user sessions represented in total seconds.
ga:sessionDuration / ga:sessions
The Reporting API returns the data to you in seconds. This is to make it easer for all developers to then format the information as they wish. You as a developer will need to loop though the results add your divide by 60 in order to format your data in minutes.
Google returns raw data formatting is up to us.
The same goes for Month of Year the standard format is YYYYMM you will need to format the data in your code.
Is it possible to make a rule like every 1 month and 10 days? Obviously 40 days isn't correct since months have a variable number of days in them, and it isn't by day of month or a particular day of the week?
Something that would generate:
1/01/2014
2/10/2014
3/20/2014
4/30/2014
6/09/2014
I'm not so familiar with ice_cube, but just by checking out the README I think this could work:
schedule.add_recurrence_rule Rule.monthly.day_of_month(10)
Since IceCube's goal is to be iCal compliant, and that type of recurrence rule is not supported by the iCal spec as far as I can tell, this type of rule is impossible with IceCube.
Had to roll my own system.