What is the difference between Ad_group_ad and Ad_group tables? - google-ads-api

I was asked to call Google-Ads API in order to create a report with these fields:
I went to ad_group_ad table.
I wanted to make sure I understand this table's meaning:
Why isn't this just called Ad?
What is the difference between Ad_group_ad and Ad_group tables?
There were a few metrics which I couldn't find in ad_group_ad
I couldn't filter the views which contain them (for example impression_share)
I know impression_share exists for keywords and campaign, so I found them in the relevant tables. So I understand they cannot be broken down at an ad level.
But I still couldn't find the other highlighted metrics even at a campaign level.
Here is my campaign query try:
SELECT
metrics.clicks,
metrics.impressions,
metrics.ctr,
metrics.cost_micros,
metrics.cost_per_conversion,
metrics.cost_per_all_conversions,
metrics.all_conversions_from_interactions_rate,
metrics.all_conversions_value,
campaign.name,
campaign.id,
segments.device,
segments.date,
campaign.advertising_channel_type,
segments.click_type,
campaign.geo_target_type_setting.positive_geo_target_type,
campaign.geo_target_type_setting.negative_geo_target_type
FROM campaign
WHERE
segments.date BETWEEN '2020-01-01' AND '2022-01-01'
ORDER BY
campaign.start_date DESC
LIMIT 100

The AdGroupAd (ad_group_ad) is the Google Ads API representation of the actual Ad inside a specific Campaign's Ad Group (ad_group) object. The AdGroupAd has a sub-object called Ad which holds additional property to only go deeper into the specific Ad types like RSA, Call Ad, Expanded Text (for a few more weeks), etc.
I find it helpful to traverse the Google API Docs starting with the AdGroupAd and work your way down to the Ad and specific Ad Types to see the hierarchy.
https://developers.google.com/google-ads/api/reference/rpc/v11/AdGroupAd
From a reporting standpoint, via the API you will be able to see the specific AdGroup any given AdGroupAd is attached to so and then you can then get to the actual Campaign by either ID or Resource Name.
https://developers.google.com/google-ads/api/reference/rpc/v11/AdGroup

Related

Using endsWith filter together with expanding user's memberOf doesn't work

I want to fetch all users together with their group names from MS Graph API.
It works as long as I don't want to do some advanced filtering (endsWith()).
Here's the select query I'm running:
https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$expand=memberOf($select=displayName)
It produces a nice set of users together with the display name's of groups they are in.
I wanted to restrict the result to a specific mail domain (i have added ConsistencyLevel: eventual), however I am unable to do it unless I remove the memberOf expand. This works:
https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$count=true&$filter=endsWith(mail,'#somedomain.com')
But as expected, there are no groups. In fact, there are no groups at all despite selecting memberOf! I thought I'll just fetch groups first and then pair them in my code, but to get them I must expand, and with expand the filter doesn't work!
This produces an Request_UnsupportedQuery error:
https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$expand=memberOf($select=displayName)&$count=true&$filter=endsWith(mail,'#somedomain.com')
Is there any way to achieve what I want without filtering manually or issuing multiple requests and mapping stuff on my own? We're talking about directories containing tens of thousands of users.. Graph seemed to be nice at the beginning but as I wanted to do anything more complex it turns out to be a limited POS where one query totally excludes another. I was also unable to filter by the expanded memberOf in any way
Based on Microsoft Docs
$expand is not currently supported with advanced queries.

How does function Match of Acumatica works

How does work function Match in Acumatica?
For example I can't understand what following code does (this is code from coderepository.xml). Why in first case we don't mention table, but in second we mention table.
1. Search<InventoryItem.inventoryID,
Where<Match<Current<AccessInfo.userName>>>>
2. Search2<APInvoice.refNbr,
InnerJoin<Vendor, On<APInvoice.vendorID, Equal<Vendor.bAccountID>>>,
Where<APInvoice.docType, Equal<APInvoiceType.invoice>,
And<APInvoice.vendorID, Equal<Current<FAService.vendorID>>,
And<Match<Vendor, Current<AccessInfo.userName>>>>>
Match is used to filter records based on the restriction groups in place. Restriction groups are used to support row-level security; for example you can use that to restrict some users to specific products, specific customers or specific vendors. The internal implementation is quite complex, and relies on a bit mask field called GroupMask. Although it is used on a few specific entity types, it can be extended to work with custom entities.
There's a whole chapter on row-level security in the Acumatica User Guide, which should provide you with all the information you need on setting it up.

Neo4j how to do a highscore system

I work in a company that makes a social game where our users can have friends and can make content that based on popularity shows up on highscores.
I am trying to find out whether we can move some of our data to a graph database like neo4j and one of the things I can't figure out is how to implement a highscore system in a graph database. I basically want to make queries like this:
Get list of movies/artbooks/photos content created by friends ordered by content with most likes.
Get list of movies/artbooks/photos content created by ALL USERS in the last 7 days ordered by content with most likes.
What kind of data modeling and queries should we do to implement this?
The datamodel I was planning to do was to have users as nodes and the content made by a user linked to the user as a list of connected content nodes with the latest one linked to the user, but how do I get highscores into such a model.
Thanks.
Here is one possible model:
(f:User {name: "Fred"})-[:CREATED]->(c:Content {created: 2345, type: "Music"})
(m:User {name: "Mary"})-[:LIKES {score:5}]->(c:Content)
(f)-[:KNOWS]->(m);
To get the content created by all Users since a specific timestamp, in descending order by the number of likes, you can use the following query. The OPTIONAL MATCH is used to avoid filtering out Content with no likes.
MATCH (c:Content)
WHERE c.created > 1234
OPTIONAL MATCH ()-[l:LIKES]->(c)
RETURN c, COUNT(l) AS num_likes
ORDER BY num_likes DESC;
Here is a console that illustrates this.

Implement privacy settings in status updates in Neo4j database

Social Networks nowadays allow a user to set privacy settings for each post. For example in Facebook a user can set privacy setting of a status update to "just me", "friends", "public" etc. How would one design such a system in Neo4j (no documentation on something like this)?
One way would be to set a property for each post. But this doesn't look scalable as this feature cannot be extended to something like "share with group 1" (Assuming users are allowed to create their own groups (or circles in google+)). Also, when a user tries to access the newsfeed, merging separate results from "just me", "friends", "public" sounds like a nightmare.
Any suggestions?
For the sharing-level I'd set a label on the content (:SharePublic (or leave that off) :ShareFriends, :ShareGroup, :ShareIndividual)
For groups and individuals create a relationship from the content.
To aggregate the newsfeed for a user
Until limit
go over potential news items
allow public
allow individual if pointing to me
allow group if pointing to one of my groups
allow friend if friend with author (check if there is a friendship rel from me to author)
As the feed is a core high performance use-case I'd probably not do it in cypher but a server extension.
Cypher "pseudocode"
MATCH (u:User {login:{login}})
MATCH (:Head)-[:NEXT*1000]->(p:Post)
WHERE p:SharePublic
OR p:ShareIndividual AND (p)-[:SHARED_WITH]->(u)
OR p:ShareFriend AND (p)<-[:AUTHOR]-()-[:FRIEND]-(u)
OR p:ShareGroup AND (p)-[:SHARED_WITH]->(:Group)<-[:IN_GROUP]-(u)
RETURN p
LIMIT 30

Desire 2 Learn Org Unit ID

What is the API call for finding a particular orgUnit ID for a particular course? I am trying to pull grades and a class list from API but I can not do it without the orgUnitID
There's potentially a few ways to go about this, depending on the kind of use-case you're in. Firstly, you can traverse the organizational structure to find the details of the course offering you're looking for. Start from the organization's node (the root org) and use the route to retrieve an org's descendants to work your way down: you'll want to restrict this call to only course-offering type nodes (org unit type ID '3' by default). This process will almost certainly require fetching a large amount of data, and then parsing through it.
If you know the course offering's Code (the unique identifier your organization uses to define course offerings), or the name, then you can likely find the offering in the list of descendants by matching against those values.
You can also make this search at a smaller scope in a number of ways:
If you already know the Org Unit ID for a node in the structure that's related to the course offering (for example, the Department or Semester that's a parent of the course offering), you can start your search from that node and you'll have a lot fewer nodes to parse through.
If your calling user context (or a user context that you know, and can authenticate as) is enrolled in the course offering, or in a known parent org (like a Department), then you can fetch the list of all that user's enrollments, and parse through those to find the single course offering you're looking for. (Note that this enrollments route sends back data as a paged result set, and not as a simple JSON array, so you may have to make several calls to work your way through a number of data pages before finding the one you want.)
In all these scenarios, the process will end up with you retrieving a JSON structure that will contain the Org Unit ID which you can then persist and use directly later.

Resources