Latest posts

Browse topics

How to Send RSS Web Push Notifications to Segments in OneSignal

It has been already more than one year since I've enabled OneSignal Web Push notifications for this blog. Over the past year, the blog has acquired more than 25,000 web push subscribers. Frankly speaking - sure web push notifications are great if used the right way, speaking of me - unfortunately, or for good, as I keep writing on many topics, I still haven't found the most optimal use for web push notifications, as readers of this blog fall into many audiences and demographics.

One of the use scenarios to sync web push notifications involves using RSS feed, see: How to send OneSignal RSS Push Notifications Using Zapier

For setting up OneSignal with Drupal see: How To Setup Web Push Notifications For Drupal 8 (Or Any Other Site) Using OneSignal

Today I will write about how to send RSS web push notification using custom-built RSS feed, OneSignal, and Zapier for the country based segment.

As usual, I will provide an example of real situation - about 743 subscribers from more than 25,000 are from Georgia. As Georgia related content is often featured on blog, I decided it would be a good to keep users engaged, by sending a new push notification every time a new Georgia related content is created. 

As a Drupaller, I've built already a pretty complicated RSS feed driven Mailchimp e-newsletter. Now, let's see can we apply the same rules for Web Push Notifications.

User segmentation in OneSignal

User segmentation in OneSignal

I wish there were better user segmentation options on onesignal, but for now, segmenting users from a country seems a good starting point.

In fact, this Web Push notification campaign will be similar to the e-mail campaigns automatically sent using RSS and Mailchimp. See: How To Sync Drupal RSS Feed to Mailchimp

As I've already defined a custom RSS feed for Georgia related content I will just simply reuse it: https://www.reinisfischer.com/georgia.xml

To make the magic happen I should make a Zapier app, and here is the details:

From your Zapier account make a new Zap -  RSS + OneSignal

As the steps are pretty easy to complete setting up the connection, I will not cover them here, just once in editing OneSignal settings, make sure to include your segment in Segment Names to Send To 

Segment Names to Send To

Segment Names to Send To 

The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: ["Active Users", "Inactive Users"]. Use All to send to all users.

That's it - make sure to save your configuration and enable this ZAP. 

How to Prepare for Drupal 7 to 8 Upgrade - Planning

It has been more than 4 years since I started this blog. During the years it has evolved a lot, featuring about 1500 articles, extended of using about 60 modules and what's not less important - attracts about 100,000 users monthly. For more than 4 years this website has been running on Drupal 7.

Despite me thinking of Drupal 7as one of the best Drupal versions so far, I understand the importance of upgrading to the latest Drupal 8 version. Drupal 8 features a lot of new and cool features, one of the things I like the most - composer for updating site functionality. Sure, there are many pitfalls also. Personally, I think it will take about 6 months for me to completely upgrade to the latest Drupal 8 version, as still there are many modules not yet supported in D8.

During the last two years I've built a few Drupal 8 sites from scratch and written a dozen of articles (mostly covering Drupal Nginx stuff), so I'm not a complete novice with Drupal 8.

Here are few articles related to configuring Drupal 8 environment

See a complete list of Drupal 8 articles

Alternatively, see:

Now, returning to the subject of this article:

Planning an upgrade from existing, custom built Drupal 7 website to Drupal 8

Backups. It all should start with backups. For my blog, I'm running a separate VPS from Linode (paying $62.5/mo). I have Linode backups enabled already, and that's great.

Before upgrading to Drupal 8, I plan to purchase additional Linode VPS, set and configure it for Drupal 8 (see above) and migrate a copy of my existing Drupal 7 website there. Having a separate development environment will help. Each new Linode VPS comes with a separate IP.

After the successful D7 to D8 migration, I will change just DNS entries to point to the new IP address or more probably - after successfully migrating and developing blog under D8, I will temporary change DNS to point to the new VPS and then will transfer back to the existing, but already upgraded VPS (just to make sure IP stays the same)

As usual, I will keep publishing updates in the Drupal development series. If you have any comments, suggestions, or you have recently done D7 to D8 upgrade, leave a comment, readers and I would love to hear.

DIY Open Wooden Compost Bin

A compost bin is a must-have garden construction at our rural property - fallen leaves and trimmed grass mostly go here. It was on early May 1st, 2017 evening I decided to build an open wooden compost bin from materials we left over from roof works. 

It was agreed to install a compost bin on the other side of the house, as when planning a place for a compost bin, it should be chosen carefully, so as not to be an obstacle in the future.

Choosing a place for a compost bin

Choosing a place for a compost bin

As there is already an old foundation here, and we are not planning to do with them anything for the next couple of years, it was agreed this is a good place for a compost bin. Now it was a matter of taking down the laths from the loft, an electric saw, some measurement tape, a pencil, and a level. 

Wooden boards for compost bin

Wooden boards for compost bin

A little experiment here, adjusting height and weight.

Leveling boards

Leveling boards

Definitely much easier than leveling bearing beams for the roof construction.

The result

The result

11 Katkha Tbilisi Restaurant on Nikoloz Baratashvili street

11 Katkha has been my favorite Georgian cuisine Tbilisi restaurant for years, for a long time I loved to visit 11 Katkha restaurant near Dinamo stadium, sadly one-day I learned that Dinamo stadium branch is closed.

From my understanding 11 Katkha is a restaurant chain, as soon I found another branch in Saburtalo. I've been heading to Saburtalo for about a year, just to enjoy the best katmis mcvadi in town.

Now, huge was my surprise discovering 11 Katha restaurant opened in the city center (close to the Freedom square) on Baratishilli street.

Interior at 11 Katkha on Baratishvilli street in Tbilisi

Interior at 11 Katkha on Baratishvilli street in Tbilisi

When speaking about 11 Katkha - it's all about katmis mcvadi, kitris pomidori salati, turkuli kava, imeruli hachapuri and sometimes, just sometimes, badrijani.

Georgian cuisine

Georgian cuisine 

I love Katkha for one another reason - prices - they keep it low and affordable. Average bill for two persons 40 GEL, for 3 persons 60 GEL (of course it depends)

Chicken barbecue with pomegranate dressing

Chicken barbecue with pomegranate dressing

How to Enable OneSignal Web Push Notifications SendTag For Drupal (User Segmentation by Interests)

I spent a good amount of time, trying to learn how to implement a better user segmentation on OneSignal. The best I could get so far was the default OneSiganal's out of the box segmentation based on user country.

As my blog covers many mutually unrelated topics, I was not utilizing the power of push notifications at 100%. In fact, after getting more than 26,000 subscribers (over a year) I felt afraid every-time I sent out a web push notification, as user targeting was very poor.

At OneSignal official documentation, I learned about using Data Tags, especially SendTag and SendTags

Once you've integrated OneSignal in your app or website, implementing tags is very straightforward - simply use the sendTag or sendTags methods to tag your users with a key-value pair at any time. You may also get and delete tags with other methods. To learn more and to check out code examples, dive into the SDK reference for your particular app or website.

Here is the code example, you should call

OneSignal.push(function() {
  /* These examples are all valid */
  OneSignal.sendTag("key", "value");
               
  OneSignal.sendTag("key", "value", function(tagsSent) {
    // Callback called when tags have finished sending
  });
               
  OneSignal.sendTag("key", "value").then(function(tagsSent) {
    // Callback called when tags have finished sending
  });  
});

As it was hard to understand what to do next, I thought about following "workaround" using Drupal blocks, before diving in, here are the things you will need:

Now, create a new block and paste in (using php filter) following code:

<script>
OneSignal.push(function() {
  OneSignal.sendTag("category", "investments");         
});
</script>

Where category = key and investments = value

Make sure to enable check box to display this block on investments category only. Also, you should put this block somewhere in enabled block regions to make it work. As I'm using custom MailChimp subscribe forms for collecting e-mail at te the end of articles, I put this code inside MailChimp block.

How to add MailChimp Signup Form for Drupal

For tracking multiple categories create new block, with new key and value, for example


<script>
OneSignal.push(function() {
  OneSignal.sendTag("category1", "shopping");         
});
</script>

And so on. 

In case user has already subscribed at investment page, but after is visiting shopping page, both values will be recorded:

Collecting user tags on OneSignal

Collecting user tags on OneSignal