How do I track the performance of dynamic links created with the REST API (programmatically) in the Firebase console? - firebase-dynamic-links

I'm using jQuery ajax request to make dynamic links but it doesn't show up in firebase dynamic links analytic console to keep track of its events.
as per firebase documentation (https://firebase.google.com/docs/dynamic-links/create-links), it supposed to do so... any insight will be highly appreciated ...
$.ajax({
type: "POST",
url: "https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=" + api_key,
contentType: "application/json",
processData: false,
data:JSON.stringify({
"dynamicLinkInfo": {
"dynamicLinkDomain": "yx55s.app.goo.gl",
"link": cLink,
"socialMetaTagInfo": {
"socialTitle": sTitle,
"socialDescription": sDesc,
"socialImageLink": sImg
}
},
"suffix": {
"option": option
}
})
}).done(function(links){
console.log(links);
$('.response').text(links.shortLink);
});
})

As de.sk mentioned, Dynamic Links created through the API don't appear in the Dynamic Links section of the console.
However, there is now a REST API to allow you to retrieve stats for dynamic links created through the API. You can see the docs here: analytics api docs: https://firebase.google.com/docs/reference/dynamic-links/analytics

Dynamic Links created using the API are not displayed in the Firebase console. You can instead use the Firebase Dynamic Links Analytics API. As the documentation says
You can use this REST API to get analytics data for each of your short
Dynamic Links, whether created in the console or programmatically.
Ref: Dynamic Links Analytics API Documentation

Related

Whatsapp Cloud API Update Profile Picture

I'm trying to upload an image as profile picture using WhatsApp Cloud API *.
After creating an application using WhatsApp Cloud API I'm not allowed to access neither using the regular application nor using Business Application. It says something like "try again in one hour". So I have to implement everything using the API.
After reading the docs and importing Postman Endpoints I found the one called Business Profiles > Update Business Profile
https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/whatsapp_business_profile
It has a field "profile_picture_url"and I have tried POSTing media https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/media and then with the given ID y used https://graph.facebook.com/{{Version}}/{{Media-ID}} to get the URL but it didn't work. The rest of the information is updated successfully
{
"messaging_product": "whatsapp",
"address": "",
"description": "Simple Bot",
"email": "...#gmail.com",
"websites": [
"https://..."
],
"profile_picture_url": "https://lookaside.fbsbx.com/..."
}
However if I try to send someone using the ID and the endpoint https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/messages it works fine.
And if I use Download Media Content with the URL in Postman it works fine too.
I don't know if I have misunderstood something or if it can't be done using the API.
It is mentioned in the Cloud API Documentation:
profile_picture_url (Optional): URL of the profile picture generated from a call to the Resumable Upload API.
But, i got it working using profile_picture_handle instead of profile_picture_url. So how do we get the profile_picture_handle?
Prerequisite:
Graph API token here. Or use your WhatsApp Cloud API token.
App ID, go Apps > Your App > Settings (sidebar menu) > Basic
Update Photo Profile:
Call POST https://graph.facebook.com/v14.0/{{appId}}/uploads?access_token={{token}}&file_length={{fileSizeInByte}}&file_type=image/jpeg
Save the session id you got, upload:XXXXXX?sig=XXXXXX.
Call POST https://graph.facebook.com/v14.0/{{sessionId}}, with the headers: Authorization=OAuth {{token}}, file_offset=0, Host=graph.facebook.com, Connection=close, Content-Type=multipart/form-data, and include your image file in the request body with type binary. If you using Postman, see image below (This is what I missed for hours).
Save the handle result you got, 4::XXX==:XXXXXX.
Finally, call POST https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/whatsapp_business_profile, with json request body: {"messaging_product": "whatsapp", "profile_picture_handle": "4::XXX==:XXXXXX"}
That's it, You can check the profile picture.
The last step you have to add your taken by selecting "Bearer" or else it will give you error. I had hard time on the last ones, do all the steps and then go to the following link and it should help.
https://web.postman.co/workspace/My-Workspace~a4ddb3b8-02a3-4132-8384-66e63e149b7b/request/22958165-506a0542-c845-41ac-b3fb-b8209fd6f53b

How to pass SPA version in Google Analytics and VueJS?

I have a VueJS SPA in which I have defined a build version that I can easily access as a javascript variable.
I have used VueGtag (https://github.com/MatteoGabriele/vue-gtag) to integrate Google Analytics with my SPA. I would like to view reports in Google Analytics for build version, so I can keep track with version adoption.
I've read about Custom Variables, but I can't see to get this to work and passed over to Google Analytics. Here is what I have at the moment:
Vue.use(VueGtag, {
config: {
id: "UA-XXXXXXX-X"
},
}, router);
And in my main App.vue, I have this in mounted():
this.$gtag.customMap({ 'dimension1': 'version' });
this.$gtag.event('version_event', { version: buildTs });
I have already confirmed that buildTs exists and is accessible in App.vue. However, I don't see any reporting of 'version' in GA.
You need to go into GA and under the settings for that property, create a new dimension to track the version.
Take note of the "index" of that custom dimension. It will represent "dimensionX", in your gtag code.
Also, I'd recommend to pick the "session" scope, this just means that the dimension will be the same for the whole session. More info on scope: https://support.google.com/analytics/answer/2709828?hl=en

Is it possible to get raw data from a Metabase MBQL / SQL query via the REST API?

Is there a Metabase REST API that takes a MBQL/SQL query and returns the raw data?
I can perform a MBQL query via the API in a 2-step process by doing the intermediate step of creating a Question via the Metabase web app UI and then querying the Question, but I haven't figured how how to combine MBQL with the REST API in a single step.
Some items I'd like to accomplish by having the MBQL in the API request instead of a UI-generated Question:
better version management as the MBQL query can be checked into source control with the code
better isolation as the API call won't be dependent on the question which can change
Here's some info on how to perform the 2-step process.
2-Step Process
The two step process is:
Use web app to create a MBQL/SQL Metabase Question
Use REST API to query existing Question created in web app using the Card API
Step 1) Creating Question via Web UI
Log into the web app and click the "New Question" button in the top menu.
Once your question has been created you will be directed to a URL like the following where :question-id is an integer.
Web UI endpoint: GET /question/:question-id
Note this value and use it in the API in the next step.
Note: an alternative for creating the card is to use the POST /api/card API endpoint per YakovL. This can be useful in some scenarios were UI questions/cards are desirable, but I'm also trying to avoid creating creating cards / questions in the first place, since I'm not planning on using the Metabase UI to consume them. Reasons to avoid cards for me include needing to perform extra work to verify the card query definitions haven't changed but still having the SQL in the code to create the cards, and generate a lot of unneeded question cards in the UI.
Step 2) REST API for Question Data
The API uses the term "card" for the Web UI "question" object, so make an API call to the following Card API:
API endpoint: POST /api/card/:card-id/query/:export-format
In this URL:
:card-id is the :question-id from the Web UI URL
:export-format can be json or another format
More information on the API is available in the API Documentation:
https://github.com/metabase/metabase/blob/master/docs/api-documentation.md
Question
Is there a way to do this directly by sending the MBQL/SQL query in the API request in a single step without a pre-existing Question/Card?
Querying via raw SQL and MBQL are both available via the POST /api/dataset/ API. The documentation for the endpoint mentions the query request definition but does not define it.
I ended up doing some more research and asking on the Metabase Discourse forum. The following examples were posted by sbelak.
Raw SQL Query
I was able to successfully make a native SQL query using the go-metabase SDK to make the following request:
POST /api/dataset
Content-Type: application/json
X-Metabase-Session: <sessionId>
{
"database": 1,
"native": {
"query": "SELECT COUNT(*) FROM orders"
},
type: "native"
}
Notes:
The POST /api/dataset does not set the response Content-Type header.
There is a POST /api/dataset/json endpoint, but that does not seem to accept the native property.
To set X-Metabase-Session see github.com/goauth/metabase.
MBQL
POST /api/dataset
Content-Type: application/json
X-Metabase-Session: <sessionId>
{
"database": 1,
"type": "query",
"query": {
"source-table": 2,
"breakout": [
[
"binning-strategy", ["field-id", 14], "default"
]
],
"aggregation": [["avg", ["field-id", 17]]]
}
}
Notes:
To set X-Metabase-Session see github.com/goauth/metabase.

IBM Connections Blog recommend API

I am working on Blog APIs of IBM connections 3.0
From IBM Docs I got details about how I can recommend a blog entry and how I can get list of peoples recommended blog entry.
I Need API details, how I can undo my recommendation for particular blog.
In web IBM connections is calling /blogs/roller-services/json for the this action which requires "dangerousurlnonce" to be posted, I could not find, how I can get the value for "dangerousurlnonce" either.
-- Vishal
Try this:
$.ajax({
url : 'blogs/roller-services/json/authcheck?entry=' + entryId,
success : function (data) {
// yes we need to use dojo here as the response is invalid json that only dojo can parse
dangerousurlnonce = dojo.fromJson('{' + data + '}').nonce;
}
});

BigCommerce API to Search products

We are trying to build a mobile app for a Big Commerce based shop. We want to implement a simple product search feature - User will enter a search keyword, application should display all the products which matches that search keyword.
There don't seem to be any straight forward Big Commerce API to achieve this. Product has a field named "search_keywords" but surprisingly this is not listed in possible filters for querying a list of products. Can some body throw some light on how to implement a simple search feature using BC APIs.
Bigcommerce themes have a feature called QuickSearch that allows for fetching n XML list of matched products (and content pages) via AJAX but you will come across cross-origin domain issues if your server is not configured correctly. One example would be:
$.ajax({
type: 'GET',
dataType: 'xml',
url: config.ShopPath + '/search.php?action=AjaxSearch&search_query='+encodeURIComponent($('#search_query').val()),
success: function(response) { QuickSearch.search_done(response); }
});
Search keywords is used for web store search, it is not surfaced via API. If you want to build an entire search solution via API, it is going to be hard unless you GET the products and cache it. Check out an app called searchspring from BC app store, which implements an faceted search. Cheers!