I’ve encountered a problem during Onesignal Integration Setup.
I did setup of the plugin properly, I did set all the credentials and checked all the features I wanted to use:
Enabled features
- Mobile app notifications
- Enabled on landing pages?
- Welcome notification
- Enable on tracked pages?
I followed the instructions on these tutorials:
- Web notifications | Mautic
- https://mautic.com/help/web-notifications-mautic-landing-page/
- https://www.youtube.com/watch?v=BUfxw1Iq11k
However it doesn’t seem to work.
- I inlcluded mautic JS tracker in my webpage. The onesignal javascript gets included, yet I get no popup
- On a mautic landing page I don’t even see that the onesignal javascript gets loaded. However when I check the html source, there is this javascript snippet in the header:
<scr ipt data-source="mautic">
disable_notification = true;
</scr ipt>
I dag into the code and found that app/bundles/NotificationBundle/EventListener/PageSubscriber.php
puts this js snippet out.
public function onPageDisplay(PageDisplayEvent $event)
{
$integrationObject = $this->integrationHelper->getIntegrationObject('OneSignal');
$settings = $integrationObject->getIntegrationSettings();
$features = $settings->getFeatureSettings();
$script = '';
if (!in_array('landing_page_enabled', $features)) {
$script = 'disable_notification = true;';
}
$this->assetsHelper->addScriptDeclaration($script, 'onPageDisplay_headClose');
}
When I var_dump $settings
and $features
I get this:
``` object(Mautic\PluginBundle\Entity\Integration)#876 (9) { ["id":"Mautic\PluginBundle\Entity\Integration":private]=> int(1) ["plugin":"Mautic\PluginBundle\Entity\Integration":private]=> NULL ["name":"Mautic\PluginBundle\Entity\Integration":private]=> string(9) "OneSignal" ["isPublished":"Mautic\PluginBundle\Entity\Integration":private]=> bool(true) ["supportedFeatures":"Mautic\PluginBundle\Entity\Integration":private]=> array(2) { [1]=> string(28) "landing_page_enabled" [2]=> string(21) "welcome_notification_enabled" [3]=> string(21) "tracking_page_enabled" } ["apiKeys":"Mautic\PluginBundle\Entity\Integration":private]=> array(4) { ["app_id"]=> string(229) "********" ["safari_web_id"]=> string(257) "********" ["rest_api_key"]=> string(257) "********" ["gcm_sender_id"]=> string(197) "********" } ["featureSettings":"Mautic\PluginBundle\Entity\Integration":private]=> array(2) { ["subdomain_name"]=> string(30) "{mydomain}" ["platforms"]=> array(1) { [0]=> string(7) "android" } } ["changes":protected]=> array(0) { } ["pastChanges":protected]=> array(0) { } } array(2) { ["subdomain_name"]=> string(30) "{mydomain}" ["platforms"]=> array(1) { [0]=> string(7) "android" } } ```
In this latter array I se no mention of the enabled features that I checked on the plugin configiration panel.
What do I do wrong?