How do number based permission systems work? - math

This is NOT a question about Discord, but about how a feature on Discord was implemented.
Discord has a system in place where a set of numbers added together can represent a set of selected permissions. I spent some time looking around the internet and playing with Discord's link generator to form an understanding of what is happening but I haven't been successful.
In the following image, it can be seen that I have selected a set of permissions for a small bot and in the generated URL a number is provided under the permissions parameter:
What I don't understand is, how are the numbers (for each permission) assigned such that when any combination of numbers is added together there are no conflicting/ambiguous results?
Also, once a number is generated, how are the numbers interpreted and converted back to their original meanings?

Every individual tickbox corresponds to one bit position. The final number is the binary number obtained by writing "1" at every ticked position and "0" at every non-ticked position.
For instance, "Manage channels" is 0b00010000 = 16 and "View audit log" is 0b10000000 = 128, hence if you tick both "Manage channels" and "View audit log" and nothing else, you'll get 0b10010000 = 144.
Source: https://discordapi.com/permissions.html#144

Related

Average scroll rate in Google Studio

I want to calculate and display the average scroll depth in Data Studio from analytics.
I’m looking to get an average scroll depth in Studio. I’ve got the 10%,25%, etc scroll depth data coming in, but I now need to be able to calculate the average scroll % from this data.
To calculate the average scroll depth:
multiply the scrolled threshold by the number of events (10x500) + (20x400) + (30x475) +(40x300) + (50x200) + (60x100) +(70x75) +(80x60) + (90x20) + (100x10)
Then, take that total divided by the total number of events. 500 + 400 + 475... etc
Because I can’t reference cells in Studio I can’t get it to work. I’ve also tried Google Sheets, which does work to do the calculation, but then I can’t use Data Studios filter to provide a specific page path?
I'm thinking that perhaps the calculation will need to be done at data source, but I am not sure how to reference a 'cell'?
Data Studio doesn't work based on a concept of "cells", it works based on a concept of "fields"—which are basically properties of the data source. Similarly, you don't have "formulas" per se, but rather "calculated fields". These fields can be created either at the chart-level (single-use, but doesn't require permissions to modify the data source) or in the data source (reusable across many charts, requires permissions to modify the data source). Most fields also have an aggregation type, which tells the report how to aggregate it in charts by default (e.g. Sum or Average).
When you either edit your data source and hit "Add Field" or the option with the same name under the "Add metric" or "Add dimension" menus on a chart, you'll be presented with a box to input the formula. To access a field, just type its name (of if you're in the data source, select it from the list on the left). The editor will also typically give you an auto-complete list below your cursor based on what you're typing. Once your entry matches a field, it will get a highlight box around it (the color is based on the type; green = dimension/string,blue = metric/number). The functions available are sort of a mash-up of something between what you'd expect in Google Sheets and in a SQL query, but with more constraints on when you're allowed to use certain functions.
The documentation for calculated fields is pretty simple, so I'd recommend starting there before you try to do too much heavy-lifting in Data Studio. Because of constraints in Data Studio's data model, you'll often find that you need to create separate calculated fields for different parts of the formula, and then combine them in a new calculated field. I'll warn you that the error messages in the field editor aren't super helpful sometimes, so you may need to re-read the documentation for the functions and field types you're working with to ensure you get a valid result.
If you're running into problems, including the field names and values that you need in your calculation may help, including the source of the data (are these GA events?). The more details you give, including what you've already tried, the more helpful we can be. Also, make sure to read the docs first to make sure you have a good handle on the product you're using and the terminology the community is most likely to understand.

How do I add Google-Authenticator to a second phone/tablet (my backup 2FA) for Google-Accounts

I already have Google-Authenticator on my iPhone - yay!
I want to have it on my iPad too (which I don't carry with me daily). I cannot see how to set that up in Google's online advice.
I don't want SMS as second factor because it is not in any way safe in 2017. SMS as a second factor is less secure than a strong password alone.
Go to https://myaccount.google.com/security/signinoptions/two-step-verification on your Mac/PC.
Generate, and perhaps print off some "Backup Codes"
Log out and log in to test one of those ten backup codes (perhaps a different browser so that login requires the second factor).
On your iPhone, delete the line in Google-Authenticator for the existing Google-Accounts setup.
Click on the pencil icon, to the right of the "Authenticator app (Default)" you already have.
Click "Change Phone", and show the new QR code the screen. In both iPhone and iPad scan the QR code. Yes, the same QR code twice. Note now that the one-time-passcode is the same on both. Do both quickly as there is only a certain amount of time to complete this in.
Note: I could not find a way of deleting the backup codes. I mean I can shred the printout, but can't see how to get the list of second-factors in Google-Accounts to drop the backup codes.

Google Analytics Goal Not Recording Accurately

I'm not getting the right results returned for a goal I have set up. The goal says the last 7 days have 92 goal conversions, when it should be 400+.
When a user completes a subscription purchase, they land on a confirmation page. We have several subdomains that the user can be coming from as well as the potential for a reference appended to the URL. So, I have the goal set up as a regular expression like this:
.*/insider/confirm.*
If, for example, the user pays and then is directed to the following page, shouldn't the goal be recorded?
test.com/insider/confirm?ref=2343
As I can't see anything wrong with the regular expression, although very greedy, the goals should be captured with the above example URL and goal setup.
Have you recently set this goal up? A thing with goals are that they aren't historically applicable to your data. They start collecting data from the point where you set it up.
Have you tried using the above regexp in the "All pages"-report under "Behavior"? Enter it into the filter pattern and there you can see exactly what pages your regexp would capture.

analytics event label is missing

I have problem with sending event to Google Analytics.
In some cases the event label is empty.
I can see the label in fiddler.
The category and action are always saved.
It seems as if it happens to label that are sent in low numbers.
Is there a limitation in Google analytics that it omits the label if the count to that label is relatively low and there is a lot of other traffic?
My site has a lot of traffic, millions of events per day
Once the number of data points crosses a certain threshold (depending on the report type) , GA uses sampled data to reduce the load on their servers.
To see if a report is sampled, look for a checkerboard-like icon in the upper right corner of the interface. You can click this to access a slider to increase the amount of data in a sample, but only to a certain point.
Check to see if your reports are being sampled. If so, it may well be that a label with a small number of data points gets totally overlooked and therefore shows up as zero in the sampled report.
If this is indeed your problem, you can decrease the date range until you no longer see the sampling icon.
Yes, in G4 they are now missing.
These are user fields (self made).
Also missing browser version. What a shame for Google.

Grouping visits by a number ID

I want to group visits by certain id number because every id represents a different client (think of a subdomain or something like that), for example:
http://site.com/234/home
http://site.com/234/search/something
are URL's for client 234, while...
http://site.com/155/home
http://site.com/155/search/something
are URL's for client 155.
I'm a total noob on this, thx!
Well one way permanent way to do this that that doesn't require you to change the tracking code in your markup is Advanced Segments.
Advantages of this technique in your case:
You can create each segment and given
them descriptive names (e.g., client
id);
Unlike, for instance, using an
Advanced Filter, the Advanced
Segments are active immediately (as
soon as you create them) and they
don't permanently alter your data.
Advanced Segments are simple to configure. This Post by the GA Team is an excellent step-by-step guide, or you can follow these two consecutive screen shots below:
Step 1: click Advanced Segments in the upper right-hand corner from the Dashboard view then click Create a new advanced segment when you see the view below:
There are a number of ways to configure your Advanced Segment; here i've chosen the Page Dimension from Content then selected Condition Contains then just key in a value for a path that distinguishes each client ID.
No exactly what you asked, but you can go to:
Content
Content Drilldown
See the aggregated unique pageviews and other info for each client /id/

Resources