I am trying to setup Push notifications in the mobile app. I have decided to use OneSignal for this. This topic is completely new for me and I would like to know the best practices regarding Push notifications setup in terms of user targeting. From what I got from the Google and OneSignal documentation I can target different user in two ways:
In the mobile app assign some data tags to users, e.g. 'hasItems: true', or 'isInterestedInProduct' and then create segments in OneSignal console with these user tags.
Save OneSignal PlayerId on my backend, match it with the userId and then selectively send messages to the users depending on the backend database data.
What is the preferred way to do this? Or it should be the combination of both depending on my use cases?
Is there any way to make it fully automatized? E.g. based on some analytics events, create messages in OneSignal without any changes from the mobile/backend side (only setup the mobile sdk )?
It all depends on your use case.
For sending messages to users as a group, tags are a great way to support this. For example, you could tag all users interested in a specific product, or who have visited a specific page in your app. Here is OneSignal's guide on tags.
For sending messages to a small list of specific users, storing their OneSignal player_id or using the external_id feature of OneSignal is the way to go. Here is OneSignal's guide on sending these types of notifications.
Related
I'm learning backend and API development and trying to understand how to implement some features from scratch without using any paid third party service.
I want to understand this concept from design as well as implementation pov. Please share if you have any resources where I can learn how to code the below service.
How to build in app notification service like one of these from scratch ?
Notification when user likes or comments on a post (Instagram, Twitter)
Notification when someone views your profile (Linkedin)
Notication when a channel you are subscribed to uploads a video (Youtube)
These are different from push notifications like
Notification when someone sends you a message (All chat apps)
Live status via notification of your delivery (Food delivery apps)
Push notifications need not be stored permanently in any database but what happens with in app notifications? How to build such service which is scalable too.
One possible solution I could think of is this, for notification on post like
User A has made a post.
User B likes their post.
From likePost API emit an event which will notify User A that User B liked their post, listen for these real time events on client side. This can be done via sockets.
Do not store any notifications in database, just update the notifications in UI on that event emitted by likePost API or listen to real time changes in likes attribute of a User's Post table (is this possible?) and update UI.
In UI just show all such notifications by fetching from likes and comments table.
But I wonder how scalable is this approach.
I searched but couldn't find any good resources regarding this, so please if anyone could explain this or provide link to any blog or videos it will be helpful.
(P.s. I'm an undergrad student and don't have experience in system design and architectures, just started learning about these so just curious)
Thanks.
apps like Facebook, Instagram and linkedIn provides web hook of notifications. Webhooks allow you to receive real-time HTTP notifications for subscribed events. This functionality is only available for applications with an approved use case for webhooks. Webhhook received as a notification when user comment on your post or like your post, a web hook can be used to retrieve the information of post, comment and commentor etc.
I am attaching a reference of LinkedIn web-hook.
https://learn.microsoft.com/en-us/linkedin/shared/api-guide/webhook-validation
I've a single Firebase project which includes multiple apps in multiple platforms (e.g. delivery company with different apps for customers and riders, some of them web apps, some of them iOS apps, some of them Android apps, etc).
Each of those apps registers Firebase Analytics events. It doesn't make sense to compare together those events, as they are sometimes related to very different use cases. Following with the example of the delivery company:
Customer Android and iOS apps events should be considered together, as they are all the same
Riders Android app should be apart, as they apply only to riders' actions
Landing web page app events should also be separated, as while being triggered by the same audience (potential customers) as the customers, they don't have any thing to do with the customer app events.
The problem is all these events are presented together in Firebase Analytics dashboard and I can't find a way to segregate them by these "concerns". Ideally I would have three separated dashboards (customers, riders and landing page). I've tried creating different audiences, but the dimensions I found didn't made a fit. I can filter by platform, SO, etc, but nothing like "this user triggered these events in this Firebase app".
My bet right now is tagging all the events from the riders app with a default parameters like {'app': 'riders-app'}, but I guess there should be a better way to achieve this.
Not sure if this is the same (I'm also just starting to experiment with this), but you can define Audiences (in Google Analytics) for the different apps.
Go to Configure -> Audiences -> New audience -> Create custom
The filter is under "Platform / device" -> Stream
Note: you might need to play with the scoping parameter, not to have some crosstalk from users that use more apps - I'm not that far yet, so I don't know.
I have Firebase invites working with email and SMS just fine. I'm clueless when it comes to sharing via Facebook or twitter however. What are my options for sharing data with invites to facebook via Firebase? I can't find any info on this anywhere - except that Facebook offers its own invite api. I'm trying to just use Firebase if possible though, so I'm just trying to figure out how to customize the "share sheet" that I see referenced in various loctions online (without much info associated with those references). I can't tell if the share sheet is just a list of actions that I need to handle my own way, with just the email and sms option handled by google and I handle the rest of the options using the various apis out there.
In my current implementation, I use the deep link that the invite exposes and store the id of some data that I want the specific user to have access to. Then store that data in a firebase database. But what is the correct method to share to facebook users? Is it to just use facebook's api and expose it somehow in my own "custom share sheet"? Where can I find documentation on the share sheet?
Thanks for clarifying any of this if you can!
Cheers,
Mike
Currently I believe the only way to share to sources other than Email & SMS you would need to implement your own custom sharing functionality. It's hinted at in the Invites Documentation Best Practices section titled "Build a Custom Share Sheet".
Firebase Invites is built on top of Firebase Dynamic Links so if you want a link that takes the users to the app store to install your app you can create a simple dynamic link using one of these methods.
For implementing custom share sheets it depends on your platform as each has a different way of implementing sharing functionality.
My answer might not be ideal as I am looking for an alternative as well, but you could manually add different social media shares manually. What I wanted to do was send a deep link using the share feature already implemented by google but with no luck.
// Regular share I want to use this and send deep link :(
Intent myShare = new Intent(Intent.ACTION_SEND);
myShare.setType("text/plain");
String shareBody= "Messsage here";
String sub = "Title";
myShare.putExtra(Intent.EXTRA_SUBJECT, sub);
myShare.putExtra(Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(myShare, "Share using"));
/FACEBOOK SHARE
/*ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse("deeplinkhere"))
.build();
ShareDialog shareDialog = new ShareDialog(HomepageActivity.this);
shareDialog.show(content);*/
// Google Invites
/* Intent inviteIntent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
.setMessage(getString(R.string.invitation_message))
.setDeepLink(Uri.parse(getString(R.string.invitation_deep_link)))
.setCustomImage(Uri.parse(getString(R.string.invitation_custom_image)))// the image address on server for invite by email.
.setCallToActionText(getString(R.string.invitation_cta))
.build();
startActivityForResult(inviteIntent, REQUEST_INVITE);*/
//startActivity(new Intent(HomepageActivity.this,InviteActivity.class));
I am setting up Google Analytics Accounts for a Product which have multiple builds as frontend for same user base.
So we have one Product called X and have:
Web Build
Mobile Web
Android App 1
iOS App 1
Android App 2
iOS App 2 6.
The main point is identical APIs and User base is used in all platforms and apps. So if we have a user John Doe he can login in any of the web or apps.
We want to extract following information from Google Analytics.
Under User ID feature want, sessions aggregations of that user around all build and apps, but identifiable. So I can know that user John login to web yesterday and used mobile app today.
Each user belong to a customer (company) in our system. So want to segregate all information based on companies.
I already have achieved point 2 by creating a custom dimension in Google Analytics and believe that's the best way to do it.
Now need suggestions from Gurus on how to acheive point 1 using Google Analytics.
Either use single account and single property for all builds and apps
If yes, then how to identify those apps and builds in sessions
If I use multiple properties/apps in GA account then how to aggregate user sessions among all?
Looking forward to hear how guys around hand or should have handled this scenario. Cheers!
This question is extremely broad, IMO any answer your going to get is going to be primarily opinion based. So here is my opinion and a little extra info to boot.
The first issue you are going to have is that there is a difference between Mobile google analytics accounts and web analytics accounts. The two do not mix. Mobile analytics accounts insert screen views with a screen name. While web accounts insert PageViews with a document location.
There is no way to analyze between two different Google analytics web properties. Unless you intend your android and ios apps to run as websites and send it like its a webpage its not going to work. You could potentially download the data into your own system or big query and analyze it there. Comparing your custom dimension to see what the users have done differently. I would wonder at the quality of the analysis you will get as there will be no real way for you to compare the data and match it up beyond using your custom dimensions user id and possibly date.
I am adding this because I am not sure what your saving in your custom dimension.
The second issue you are going to have is tracking. Google analytics TOS does not allow you to send any identifiable information to Google.
The Analytics terms of service, which all Analytics customers must adhere to, prohibits sending personally identifiable information (PII) to Analytics (such as names, social security numbers, email addresses, or any similar data), or data that permanently identifies a particular device (such as a mobile phone’s unique device identifier if such an identifier cannot be reset).
You could for example send your companies customer id for John as a user_id but user_id is an internal valuable used for internal processing this is not something you can extract out via the api.
The User ID enables the association of one or more sessions (and any
activity within those sessions) with a unique and persistent ID that
you send to Analytics.
To implement the User ID, you must be able to generate your own unique
IDs, consistently assign IDs to users, and include these IDs wherever
you send data to Analytics.
For example, you could send the unique IDs generated by your own
authentication system to Analytics as values for the User ID. Any
engagement, like link clicks and page or screen navigation, that
happen while a unique ID is assigned can be sent and connected in
Analytics via the User ID.
The best you could do would be to create a custom dimension and send that with every hit username=johnscustomerId. Which you appear to have already done. This is what I have done in the past and it works perfectly well.
I'm using onesignal to handle pish notification for both my web and ionic app. My question is
Can I setup user segments using server rest api ?
I want to give my users ability to subscribe to specific events (channels) to limit push notifications they receive.
Example
user1 subscribed to group I'd (1,3,8)
user2 groups(5,8,11)
User3 groups(12,13)
When event happened on groups 8.
How can I send push notifications to all users subscribed to group 8 ? -in my example above notification should be sent to user1 & user2 but not 3.
(Update: This answer is now out of date because OneSignal now supports dynamically creating segments, as well as a large range of additional capabilities introduced over the years)
OneSignal doesn't currently support dynamically creating segments through the API, however there is a better way to do what you need.
You can use the tags feature to assign custom data to users, and then you can deliver notifications to users who match specific tags. Tags are typically set by calling the SetTags method in your app, but they can also be set through the OneSignal API.
In your case, for instance, you would assign the following tags to each user:
User1 Tags: group1=true,group3=true,group8=true
User2 Tags: group5=true,group8=true,group3=true
User3 Tags: group12=true,group13=true
Next, through the OneSignal API, you can use the "tags" field to only deliver your notifications to users who match one or more tags.
You could also create a segment for each tag on the dashboard, then through the API or through the dashboard you could specify which segments (and therefore tags) should receive your notification.
The problem with the approach outlined by #Gdeglin is that you will need to manage your group information on both your server and OneSignal's. When you have 2 sources of truth for something as complex and dynamic as groups you're bound to run into trouble.
For example, what happens if Group 8 is deleted? In addition to updating your own database, you'd need to use the API to update all the OneSignal users who belonged to Group 8. Imagine that group contains 1000 users. Yuck.
Instead of adding groupname tags, add a "userId" tag to each user (Player) registered with OneSignal. Now when a group changes there is nothing to update with OneSignal.
The tradeoff is that sending a message to everyone in the group requires N API calls to OneSignal instead of just one. It looks like it's possible to supply multiple tag matches in a single API call, but it's not clear how well that scales.