Anybody has the list of PlayHaven callbacks and other questions?

Hi guys,

This is relates to my other questions but for life of me I cannot seems to react to different scenarios with PlayHaven. Say when the Playhaven comes back without error but no ad (because i paused on the placement in the dashboard)

I looked at the list of callbacks in the doc but it is not clear (at least to me)  See below about the listener from the doc. When I look at the console (IOS) I cannot see any of these strings returned?

I see for instance:

contentDidDisplay: after the ad is shown on the screen

contentDidDismissWithType: Not sure about this one but it seems to show when nothing is displayed

didFailWithError: seems to show when the ad failed to display

As you can see none of these callbacks are listed in the doc. Am I using the wrong event name. Currently I am using event.status but it seems that there is also event.data which is a JSON object. If I need to use event.data, how do i use it to extract the stuff i need such as ad failed or ad is paused (so not showing but not failing either)?

Anybody here struggled with Playhaven plugin?

Thank you!

Mo


Function Details for listener

The listener must accept a table as argument. The format of the event table is:

status

string. An event status or name. Possible events: > requestSucceeded > > requestFailed > > > Includes message. See  message  below. > > didFail > > > Includes message. See message  below. > > contentDidFail > > > Includes message. See  message  below. > > shouldMakePurchase > > > Includes data. See  data  below. Possible fields: > > > > productIdentifier > > > > quantity > > unlockedReward > > > Includes data. See  data  below. Possible fields: > > > > name > > > > quantity > > willGetContent > > willDisplayContent > > didDisplayContent > > didMissContent

Hello guys,

Here an email support I sent to Playhaven for some help on making a distinction between ad that was dismiss (using "contentDidDismissWithType)  by the user or an ad that was automatically dismiss because nothing was sent from Playhaven (ie: the ad placement was paused by in the dashboard) Right now i am trying to show Chartboost if Playhaven is not showing but unfortunately if the Playhaven is shown, then when the user dismiss the ad (close button used) then the code shows Chartboost once the Playhaven is closed! (so two ads shown one after the other) I am trying to avoid that. If Playhaven is paused (no ads) then it works great (ie: Chartboost ad is shown)

Not sure if anybody has faced this issue with Playhaven but it seems that the doc is not really clear on the listener side. Revmob and Chartboost callbacks are really well documented!

In any event, I will post here if I can get anywhere so other people can learn from my struggle with this!

Thanks.

Mo 

ps: Maybe I need to look into event.data Json object??? Right now I am only working with event.status

----------------------------- email sent to Playhaven ----------------

Hello,

 

I just implemented an interstitial ad in my Coronalabs sdk based app (plug in) but I am having some issue figuring out what callbacks to use to detect the following conditions:

 

1- The ad is correctly shown

2- The ad is not showing up because a failure

3- The ad is not shown because there is nothing to show at this time

4- The ad was dismiss because of user action (ie close button)

5- The ad was dismiss because of another reason

 

I am trying to react to a dismiss (for instance) so I can show another ad network if Playhaven has no ad to show at some time. Right now I cannot seem to make a distinction between say a window dismiss because the placement has been paused for a while or a dismiss because the user dismiss the ad (use the close button)

 

Right now I am using the following callback for a window dismiss

 

 “contentDidDismissWithType” but unfortunately it does not make a distinction between the two type of dismiss.

 

Please see below  my current Lua code (Coronalabs) for showing a different ad network if the ad is dismissed. If I used that code, when the ad is dismiss then the second ad network is shown. it is ok if the dismiss was due to the fact that I paused Playhaven placement. But if the dismiss was done by the user then of course the app will basically show a Playhaven ad then the second ad network ad. Which is of not what I want. I want only one ad to show at the time.

 

Any help will be very appreciated. 

 

THANK YOU!

Mo

-------------------- my listener code ---------------------

 

local function playhavenListener(event)

    

    print("Event.status: >>>>>>>>>>>  "…event.status)

    

        if event.status == “contentDidDisplay” then

—#####  hide the activity indicator and exit the listener #####

        native.setActivityIndicator(false)

        return true

– #### show Chartboost ad if the Playhaven is paused

–#### Issue: this shows Chartboost even if Playhaven is shown and then dismiss by user!!! 

        elseif event.status == “contentDidDismissWithType”  then

         M.chartboost_show_ad()

        end

        

        

end

Mo, I would suggest a couple of things while you wait on a Playhaven response.

  1.  Invest in a table printing function.  There is one called print_r in the community code (named after the PHP table dumping function).  Here is the one I use:

    function print_r ( t )      local print_r_cache={}     local function sub_print_r(t,indent)         if (print_r_cache[tostring(t)]) then             print(indent…"*"…tostring(t))         else             print_r_cache[tostring(t)]=true             if (type(t)==“table”) then                 for pos,val in pairs(t) do                     if (type(val)==“table”) then                         print(indent…"["…pos…"] => “…tostring(t)…” {")                         sub_print_r(val,indent…string.rep(" “,string.len(pos)+8))                         print(indent…string.rep(” “,string.len(pos)+6)…”}")                     elseif (type(val)==“string”) then                         print(indent…"["…pos…’] => “’…val…’”’)                     else                         print(indent…"["…pos…"] => “…tostring(val))                     end                 end             else                 print(indent…tostring(t))             end         end     end     if (type(t)==“table”) then         print(tostring(t)…” {")         sub_print_r(t,"  “)         print(”}")     else         sub_print_r(t,"  ")     end     print() end

Then you can just do:   print_r(event)

to see what’s inside that event table.

  1. Most certainly decode that JSON string and print the resulting table using the print_r() function above:

local json = require(“json”)

local myData = json.decode(event.data)

print_r(myData)

And see what you can figure out from the data being returned to you.  With the 3rd party plugins, the vendor really needs to be the ones providing support on them.  

THANKS Rob! That’s basically what I did tonight but I just looked at what the console was giving me and noticed:

“PHPublisherContentUnitTriggeredDismiss” : user clicks on close button in the ad

“PHPublisherNoContentTriggeredDismiss” : the ad is in pause in the dashboard (so the ad is not showing)

I used the second item to detect for needs to show another network (here Chartboost) I also made a mistake (biggest problem) was to use encode instead of decode!!! (I saw encode used on another piece of code)

In any event I think I got this time after a week of struggle!

Here the code I am using in case someone suffer thru the same pain!

Thanks Rob, that the very nice suggestion!

Enjoy and let me know if you see something wrong.

Mo.

  local function playhavenListener(event)          local phData          print("Event.status: \>\>\>\>\>\>\>\>\>\>\>  ", event.status)          if event.data then         phData = json.decode(event.data)                      print("Event.data.type =  ", phData.type)           end             -- turn off the activity indicator if the ad shows up and then quit         if event.status == "contentDidDisplay" then            native.setActivityIndicator(false)         return true                  end   -- quit if the ad is shown AND the user clicked the close button         if phData.type == "PHPublisherContentUnitTriggeredDismiss" then                    return true   -- show Chartboost ad if PlayHaven is not shown..no content (probably because I paused -- the ad in the PlayHaven dashboard)                  elseif test.type == "PHPublisherNoContentTriggeredDismiss" then             M.chartboost\_show\_ad()                    end

Hello guys,

Here an email support I sent to Playhaven for some help on making a distinction between ad that was dismiss (using "contentDidDismissWithType)  by the user or an ad that was automatically dismiss because nothing was sent from Playhaven (ie: the ad placement was paused by in the dashboard) Right now i am trying to show Chartboost if Playhaven is not showing but unfortunately if the Playhaven is shown, then when the user dismiss the ad (close button used) then the code shows Chartboost once the Playhaven is closed! (so two ads shown one after the other) I am trying to avoid that. If Playhaven is paused (no ads) then it works great (ie: Chartboost ad is shown)

Not sure if anybody has faced this issue with Playhaven but it seems that the doc is not really clear on the listener side. Revmob and Chartboost callbacks are really well documented!

In any event, I will post here if I can get anywhere so other people can learn from my struggle with this!

Thanks.

Mo 

ps: Maybe I need to look into event.data Json object??? Right now I am only working with event.status

----------------------------- email sent to Playhaven ----------------

Hello,

 

I just implemented an interstitial ad in my Coronalabs sdk based app (plug in) but I am having some issue figuring out what callbacks to use to detect the following conditions:

 

1- The ad is correctly shown

2- The ad is not showing up because a failure

3- The ad is not shown because there is nothing to show at this time

4- The ad was dismiss because of user action (ie close button)

5- The ad was dismiss because of another reason

 

I am trying to react to a dismiss (for instance) so I can show another ad network if Playhaven has no ad to show at some time. Right now I cannot seem to make a distinction between say a window dismiss because the placement has been paused for a while or a dismiss because the user dismiss the ad (use the close button)

 

Right now I am using the following callback for a window dismiss

 

 “contentDidDismissWithType” but unfortunately it does not make a distinction between the two type of dismiss.

 

Please see below  my current Lua code (Coronalabs) for showing a different ad network if the ad is dismissed. If I used that code, when the ad is dismiss then the second ad network is shown. it is ok if the dismiss was due to the fact that I paused Playhaven placement. But if the dismiss was done by the user then of course the app will basically show a Playhaven ad then the second ad network ad. Which is of not what I want. I want only one ad to show at the time.

 

Any help will be very appreciated. 

 

THANK YOU!

Mo

-------------------- my listener code ---------------------

 

local function playhavenListener(event)

    

    print("Event.status: >>>>>>>>>>>  "…event.status)

    

        if event.status == “contentDidDisplay” then

—#####  hide the activity indicator and exit the listener #####

        native.setActivityIndicator(false)

        return true

– #### show Chartboost ad if the Playhaven is paused

–#### Issue: this shows Chartboost even if Playhaven is shown and then dismiss by user!!! 

        elseif event.status == “contentDidDismissWithType”  then

         M.chartboost_show_ad()

        end

        

        

end

Mo, I would suggest a couple of things while you wait on a Playhaven response.

  1.  Invest in a table printing function.  There is one called print_r in the community code (named after the PHP table dumping function).  Here is the one I use:

    function print_r ( t )      local print_r_cache={}     local function sub_print_r(t,indent)         if (print_r_cache[tostring(t)]) then             print(indent…"*"…tostring(t))         else             print_r_cache[tostring(t)]=true             if (type(t)==“table”) then                 for pos,val in pairs(t) do                     if (type(val)==“table”) then                         print(indent…"["…pos…"] => “…tostring(t)…” {")                         sub_print_r(val,indent…string.rep(" “,string.len(pos)+8))                         print(indent…string.rep(” “,string.len(pos)+6)…”}")                     elseif (type(val)==“string”) then                         print(indent…"["…pos…’] => “’…val…’”’)                     else                         print(indent…"["…pos…"] => “…tostring(val))                     end                 end             else                 print(indent…tostring(t))             end         end     end     if (type(t)==“table”) then         print(tostring(t)…” {")         sub_print_r(t,"  “)         print(”}")     else         sub_print_r(t,"  ")     end     print() end

Then you can just do:   print_r(event)

to see what’s inside that event table.

  1. Most certainly decode that JSON string and print the resulting table using the print_r() function above:

local json = require(“json”)

local myData = json.decode(event.data)

print_r(myData)

And see what you can figure out from the data being returned to you.  With the 3rd party plugins, the vendor really needs to be the ones providing support on them.  

THANKS Rob! That’s basically what I did tonight but I just looked at what the console was giving me and noticed:

“PHPublisherContentUnitTriggeredDismiss” : user clicks on close button in the ad

“PHPublisherNoContentTriggeredDismiss” : the ad is in pause in the dashboard (so the ad is not showing)

I used the second item to detect for needs to show another network (here Chartboost) I also made a mistake (biggest problem) was to use encode instead of decode!!! (I saw encode used on another piece of code)

In any event I think I got this time after a week of struggle!

Here the code I am using in case someone suffer thru the same pain!

Thanks Rob, that the very nice suggestion!

Enjoy and let me know if you see something wrong.

Mo.

  local function playhavenListener(event)          local phData          print("Event.status: \>\>\>\>\>\>\>\>\>\>\>  ", event.status)          if event.data then         phData = json.decode(event.data)                      print("Event.data.type =  ", phData.type)           end             -- turn off the activity indicator if the ad shows up and then quit         if event.status == "contentDidDisplay" then            native.setActivityIndicator(false)         return true                  end   -- quit if the ad is shown AND the user clicked the close button         if phData.type == "PHPublisherContentUnitTriggeredDismiss" then                    return true   -- show Chartboost ad if PlayHaven is not shown..no content (probably because I paused -- the ad in the PlayHaven dashboard)                  elseif test.type == "PHPublisherNoContentTriggeredDismiss" then             M.chartboost\_show\_ad()                    end

Hello guys,

I am having big issue with the Playhaven listener. The code above was working with my older app (Space Command) but it is not working on my new upcoming app which I am desperately trying to release before Apple deadline (like many of you I am sure:) When the PlayHaven ad is available (and not paused by me) everything works great (can see the ad)  BUT if I pause the placement then the listener do not seems to work correctly (ie; show Chartboost first or Revmob if CB is not available) 

I even cut and past the code above (with all the ad networks ID’s of my old app into my new app and it does not work. Chartboost or Revmob is not shown when Playhaven is paused. I am not planning on pausing Playhaven but I am trying to test in case Playhaven ad is not received in case of network issue.

The only difference is that in my old app, I used Director and the new Storyboard. Not sure if that it will make any difference. Wondering if these two framework are affecting how Playhaven listener behave.   Also one app (the old who works is on the app store) but the new is not yet on the app store. Could that make any difference? I kind of doubt it.

To cut to the chase, I was hoping a generous person here would share their Playhaven listener code so I can compare with mine and maybe figure out a reason why my code is not working. Of course I am also hoping it would help other people here who are thinking about implementing Playhaven with maybe another one or two ads networks in case Playhaven is not showing anything.

All this is about IOS.

Thanks for any help. The Apple deadline is fast approaching and I have been stuck with this issue for more than week now.

Please help!

Mo 

---------------- here my PlayHaven listener code again…do you see anything wrong with it? -----------------

local function playhavenListener(event)
    
    local phData
    
    print("Event.status: >>>>>>>>>>>  ", event.status)
    
    if event.data then
        phData = json.decode(event.data)
        
            print("Event.data.type =  ", phData.type)
 
        end
    
      
– turn off the activity indicator if the ad shows up and then quit
 
      if event.status == “contentDidDisplay” then 
 
        native.setActivityIndicator(false)
        return true
        
        end
 
– quit if the ad is shown AND the user clicked the close button
 
      if phData.type == “PHPublisherContentUnitTriggeredDismiss” then
          
        return true
 
– show Chartboost ad if PlayHaven is not shown…no content (probably because I paused – the ad in the PlayHaven dashboard)
          
      elseif test.type == “PHPublisherNoContentTriggeredDismiss” then
      
     M.chartboost_show_ad()
        
 
        end

Hello guys,

I am having big issue with the Playhaven listener. The code above was working with my older app (Space Command) but it is not working on my new upcoming app which I am desperately trying to release before Apple deadline (like many of you I am sure:) When the PlayHaven ad is available (and not paused by me) everything works great (can see the ad)  BUT if I pause the placement then the listener do not seems to work correctly (ie; show Chartboost first or Revmob if CB is not available) 

I even cut and past the code above (with all the ad networks ID’s of my old app into my new app and it does not work. Chartboost or Revmob is not shown when Playhaven is paused. I am not planning on pausing Playhaven but I am trying to test in case Playhaven ad is not received in case of network issue.

The only difference is that in my old app, I used Director and the new Storyboard. Not sure if that it will make any difference. Wondering if these two framework are affecting how Playhaven listener behave.   Also one app (the old who works is on the app store) but the new is not yet on the app store. Could that make any difference? I kind of doubt it.

To cut to the chase, I was hoping a generous person here would share their Playhaven listener code so I can compare with mine and maybe figure out a reason why my code is not working. Of course I am also hoping it would help other people here who are thinking about implementing Playhaven with maybe another one or two ads networks in case Playhaven is not showing anything.

All this is about IOS.

Thanks for any help. The Apple deadline is fast approaching and I have been stuck with this issue for more than week now.

Please help!

Mo 

---------------- here my PlayHaven listener code again…do you see anything wrong with it? -----------------

local function playhavenListener(event)
    
    local phData
    
    print("Event.status: >>>>>>>>>>>  ", event.status)
    
    if event.data then
        phData = json.decode(event.data)
        
            print("Event.data.type =  ", phData.type)
 
        end
    
      
– turn off the activity indicator if the ad shows up and then quit
 
      if event.status == “contentDidDisplay” then 
 
        native.setActivityIndicator(false)
        return true
        
        end
 
– quit if the ad is shown AND the user clicked the close button
 
      if phData.type == “PHPublisherContentUnitTriggeredDismiss” then
          
        return true
 
– show Chartboost ad if PlayHaven is not shown…no content (probably because I paused – the ad in the PlayHaven dashboard)
          
      elseif test.type == “PHPublisherNoContentTriggeredDismiss” then
      
     M.chartboost_show_ad()
        
 
        end