How to set up alert prompting a user to rate your app after launching the app 3 times:
*This article references iOS and iTunes Store. If you are developing for Android just substitute android for iOS.
SET UP A LAYER:
We First need to set up a Layer that will pop up to prompt the User to Rate the app now or later:
- Click 'New Layer' in toolbar to add a new layer.
- Name the New layer and choose a Canvas View. I named my layer 'Prompt'
- Go to Blocks tab found on left in The Component Selector:
- Add text to the two blocks. One prompting User to rate the app, the other to allow them to decline until later.
Right click the text blocks in the view to Edit there actions. Starting with Rating the app. - Next tap on the 'Events' tab in the blocks Component Settings:
- Click on the 'Tap' action. Select '+Action' and from the dropdown choose 'Open a Webpage'. Here you can input the URL link for your app to the iTunes Store. For this example, since it is a test app just input the iTunes Homepage as my URL.
- When Done Click 'Update' and then make sure to click 'Apply'. Then Click 'Update' at the bottom left of the Component Settings:
- Now Right Click the 'Decline to Rate' text block to edit its Events. Follow the same steps as before by clicking on the 'Events' tab and clicking on 'Tap' Actions, except this time from the drop down choose 'Remove all layers'. Make sure to click 'Apply' then click 'Update' form the Component Settings:
Now that your Layer is all set up, we have to head over to the 'Edit App' section to create the logic for when to prompt the layer to be added and bring the User to the iTunes Store.
EDIT EVENTS IN EDIT APP:
- Click on 'Edit app' from the toolbar.
- Click on the 'Events Tab'
- First we need to set a 'Variable' in the 'First Use' Event. Click on the pencil icon. From the drop down choose 'Set a Variable'.
- I'm going to call the Variable 'alert'. We also want to set the value to the number '0'.
- Click Add then Apply. Next we need to add actions to the Event 'Launch'. First we need to Set a variable that will add(+) the value 1 every time the app is launched to our initial value 0. This way we can launch the layer when the Value 'equals' Number we set. The Variable name will still be called 'alert' and the Value will be [[var:alert:add 1]]. This uses the variable we set on first Use [[var:alert]] and adds 1 to that value.
- Next we want to click + Action and choose 'Save a variable for Future Session'. This Action will save the number value we get every time we open the app after the 1 is added to our variable [[var:alert]].
- The final step is to add the layer that we created. You can choose any value you would like, but I choose 3, so when the user has launched the app 3 times the layer will be added asking them if they'd like to rate the app. So First Lets choose the Layer that we created to be added.
- Next we need to create a conditional expression by editing the 'When' our value 'equals' our 'set value' then the Layer will be added. In the Edit Value area that comes up when click the When field you can choose the variable we have set up by Clicking Variables and choosing alert which is what we named our variable.
- Then, since I am talking about launching the iTunes App Store, we have to tell the event to look at the system operating system I am on. You do this by choosing System values. Once you do scroll through the list to the right until you see OS. When you click it will input [[sys:os]] just as we did when adding our variable from the list. Click Apply.
- Next we need to Change the Drop down tab from 'Always' to 'equal'.
- The last step is editing that last field for our Value to equal. Since the value needs to equal [[var:alert]][[sys:os]] this means it is looking at the Number of times the app has been launched (Our Alert Variable) and the system OS (iOS). So we write it out as 3ios. This means I want to add a layer when the app has been launched 3 times on an ios device. When done just make sure to hit Apply, then scroll to the bottom of the Edit App section and hit Update to apply the changes.
Now we can generate the app and see if it is working.