What are all the items that match 'sessionDefaultChannelGrouping' in GoogleAnalyticsDataAPI(GA4)? - google-analytics-api

Problem
I'd like to know what all items does sessionDefaultChannelGrouping includes in GA4 API.
Details
In API Dimensions & Metrics (which is published with the GA4 API),
sessionDefaultChannelGrouping includes 'Direct', 'Organic Search', 'Paid Social', 'Organic Social', 'Email', 'Affiliates', 'Referral', 'Paid Search', 'Video', and 'Display'. But I don't know if each items are some as examples or all items listed.(please look at the first below image)
In [GA4] Default channel grouping(In particular, Channels for manual traffic),DefaultChannelGrouping (But not written as sessionDefaultChannelGrouping ) includes 17 items. (please look at the second below image)
Which information should I believe? Thank you for your cooperation.

Related

google tag manager eCommerce

I am getting crazy trying to get this to work.
I am pretty new to the whole Google Tag Manager thing, but after reading documentation, I got the basic google analytics to work.
Having said that, I am trying to set up an eCommerce transactions using dataLayer but I cannot seems to get it to work.
I am using the basic example taken on the main site:
var dataLayer = dataLayer || [];
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': 'T12345',
'affiliation': 'Online Store',
'revenue': '35.43',
'tax':'4.90',
'shipping': '5.99',
'coupon': 'SUMMER_SALE'
},
'products': [{
'name': 'Triblend Android T-Shirt',
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray',
'quantity': 1,
'coupon': ''
},
{
'name': 'Donut Friday Scented T-Shirt',
'id': '67890',
'price': '33.75',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Black',
'quantity': 1
}]
}
}
});
In my GTM configuration, I have the following:
- Tag Type: Universal Analytics
- Track Type: Page View
- Google Analytics Settings: {{gaTrackingID}}
- Enable overriding settings in this tag: ticked
- Enable Enhanced Ecommerce Features: true
- Use Data Layer
and in the Trigger i have:
- Trigger Type: Page view
- Trigger fires on: "Page URL contains /checkout
I forgot to mention that I have two tags enabled, one to log activity on all pages and the second one which should log the purchase.
I can in google Analytics that the visit worked correcty, but the transaction does not.
Also, can someone tell me if the section "CONVERSATIONS -> Ecommerce" displays the standard or Enhanced Ecommerce?
I am a bit confused..
Why the above does not work?
I just found out this morning that the code actually worked, but google analytics takes around 24/48 hours to reflect the changes. this is something I did not read anywhere in most of the documentation I found. This kind of make the whole testing process a bit difficult, as the only thing we can do is to check if the event is fired (as far as I know).
Perhaps there is a better way (and more instant) to test whether an eCommerce data has been pushed to google Analytics?
Try to insert page and transaction information into a single 'ecommerce' object and not separated.
Regarding the data displayed in the ecommerce report in Analytics, it depends on whether you have enabled enhanced ecommerce settings or only those standard.

Custom Dimensions Not Reporting Through to Google Analytics API V4

I am attempting to pass information collected as, "custom dimensions," from Google Tag Manager through Google Analytics and then extract them out via the Google Analytics V4 API.
I have set up four of the fundamental custom dimensions suggested by Simo Ahava in this article.
My variable setup looks like the following:
variable setup
Essentially, I have been able to successfully pass through userID_dimension, hittimestamp_dimension, clientid_dimension and sessionid_dimension to the Google Analytics dashboard, but for some reason I am not able to extract out the hittimestamp_dimension through the API.
Here's what I am able to see on the dashboard:
Google Analytics Dashboard
As far as the API itself, I am using the HelloAnalytics.py python version supplied by Google, and I am able to extract out all of the above information, minus the timestamps dimensions on the right hand side of each.
I'm storing the timestamp information in dimension2, but upon making the below call (again, using API V4) I get blank...nothing.
analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '2017-10-05', 'endDate': '2017-10-06'}],
'samplingLevel': 'LARGE',
'dimensions': [{'name': 'ga:dimension4'},{'name': 'ga:dimension2'}]
}]
}
).execute()
Upon making this call, one would expect that the above would report out dimensions similar to what the Google Analytics dashboard would show. E.g. one would think that the dashboard itself is using the API. However what prints out is blank. All other custom dimensions print out as expected.
If I try to call the above function on just dimension2 itself with no other dimension, it is also blank.
Is there something special one has to do in order to extract hit-scoped variables within the API? Or does the API just not allow hit-scoped variables to pass through?
thanks,
You forgot to add a 'metrics' field to your request, it is required as per documentation
Source: Reporting API v4 - Method: reports.batchGet
The metrics requested. Requests must specify at least one metric. Requests can have a total of 10 metrics.
The below modified request should work:
analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '2017-10-05', 'endDate': '2017-10-06'}],
'samplingLevel': 'LARGE',
'dimensions': [{'name': 'ga:dimension4'},{'name': 'ga:dimension2'}],
'metrics': [{'expression': 'ga:sessions'}]
}]
}
).execute()

Woocommerce REST API get products by attributes

Using the woocommerce v3 API, I want to filter/get products by attributes.
For example:
www.mydomain.com/products?filter[pa_color]=green&fields=id,attributes
How can I hook/modify the API so it will be able to perform such query?
As this documented in Woocommerce Rest API (that have poor documentation actually), It accepts the attribute slug/taxonomy name:
example.com/wp-json/wc/v3/products?attribute=pa_compatible-for&attribute_term=249
It works like a charm.
Good luck
According to API you should be able to sort by attribute. "Limit result set to products with a specific attribute, e.g. ?attribute=pa_color." Passing in the attribute as a normal parameter.
you should search by attribute and attribute_term, it works for me in v3.
https://example.com/wp-json/wc/v3/products?attribute=pa_color&attribute_term=55
'pa_color' is the slug of the attribute, you can find it by this link:
https://example.com/wp-json/wc/v3/products/attributes
'55' is color or value id (it's black here), you can get this id by this link:
https://example.com/wp-json/wc/v3/products/attributes/1/terms?per_page=99
'1' is the attribute id, you can get it from previous link (attributes link).

Paypal REST SDK - Billing Plans no longer retrievable after being made ACTIVE

So I'm using the Paypal PHP SDK on Github, http://paypal.github.io/PayPal-PHP-SDK/ . Some strange behavior I've noticed which I'm not sure what's going on.
So let's say I create a billing plan, but don't touch it after creation, so that the state is simple CREATED. Everything is good, I can retrieve it from the list of plans. However, the moment I change the state to ACTIVE via a patch, I can see that it is in fact active, but only just once. Any subsequent attempts to see the list of plans no longer shows that plan. What's going on? I'm literally copy pasting the example source they give.
Edit - just to expand, I know the plan still exists, because I can subscribe users to it. Weirdly the paypal page where you click ok to subscribe is extremely non verbose... doesn't even say what the price is, just to approve paying my store. And yet the Agreement object that is returned by PayPal, which includes the approval url, has all this info. Weird.
If you are using the PayPal-PHP-SDK, you could assign more parameters to Plan::all() method.
As shown in the List Plan sample code, you could pass parameter 'status' as :
try {
// Get the list of all plans
// You can modify different params to change the return list.
// The explanation about each pagination information could be found here
// at https://developer.paypal.com/webapps/developer/docs/api/#list-plans
$params = array('page_size' => '20', 'page' => '98', 'status' => 'ACTIVE');
$planList = Plan::all($params, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("List of Plans", "Plan", null, $params, $ex);
exit(1);
}
As in the case, you could change the status, and page along with page_size. This will help you get the active list of plans.
Actually, by default the list plan status is defaulted to CREATED.

Facebook ads api - get stats by day

I can successfully get campaign stats between particular dates via the API however I need that broken down day by date rather than a total.
I can see it works for the page insights API but there doesn't seem to be documentation on the ad insights API.
I'm using the following call to get the total between dates.
https://graph.facebook.com/v2.2/act_/stats?access_token=&start_time=&end_time=
However I cannot find the documentation to break it down into day by day for one query.
This answer had a solution but didn't work.
Downloading Facebook ads statistics in background (no web browser)
Thanks!
===================================================
New info:
So I can use time_increment=1 to get a break down by day however this only works with 'date_preset' however I want to set a date range. I am using the latest API
https://graph.facebook.com/v2.2/act_{$this->accountID}/reportstats
Using 'time_ranges' will merge the data regardless of using time_increment=1
Using 'date_preset' eg last_28_days does work with time_increment.
Using 'time_interval' with midnight timestamps of my timezone (as the documentation suggested) throws the following error:
[error] => stdClass Object
(
[message] => (#100) The "time_start" and "time_stop" must be integer.
[type] => OAuthException
[code] => 100
)
They are integers! Here's my complete post data
$postData = array(
'async'=>'true',
'data_columns'=>$data_columns,
/*
'time_ranges'=>array(
array(
'day_start'=>array(
'day'=>$startDate->format("d"),
'month'=>$startDate->format("m"),
'year'=>$startDate->format("Y"),
),
'day_stop'=>array(
'day'=>$endDate->format("d"),
'month'=>$endDate->format("m"),
'year'=>$endDate->format("Y"),
),
),
),
*/
'actions_group_by'=>array('action_type'),
'time_interval'=>array(
'time_start'=>$startDate->getTimestamp() ,
'time_stop'=>$endDate->getTimestamp(),
),
//'date_preset' => 'last_28_days',
'time_increment'=>'1',
'filters'=>$filters,
'access_token'=>$this->access_token
);
Ok I had to change the format time_interval to the time_range format and it worked! The documentation says timestamps will work but it doesn't, this worked:
'time_interval'=>array(
'day_start'=>array(
'day'=>$startDate->format("d"),
'month'=>$startDate->format("m"),
'year'=>$startDate->format("Y"),
),
'day_stop'=>array(
'day'=>$endDate->format("d"),
'month'=>$endDate->format("m"),
'year'=>$endDate->format("Y"),
),
),