Test PBA web SDK integration

At a glance: Test that web events are correctly structured and formatted so that PBA can parse and record them.

Test PBA web events

Principles of using the test page

Web SDK sends web events to PBA, which are made available via PBA dashboards and raw-data reports, after daily processing. To enable an efficient testing process, you send test events without waiting for daily processing. Test events are:

  • Parsed and validated on receipt. 
  • Made available to you in the user interface. This includes processing errors. If they exist, send corrected events again to make sure they are processed correctly. 
  • Are processed like any other event during daily processing. This means they are added to the dashboards and raw-data. 
Web SDK integration test page

Page main view


TestScreen_us-en.jpg
  • The most recent events appear first.
  • Event cache:
    • Contains up to 100 events
    • Older events are deleted to make way for newer events
    • Cached events are deleted after 24 hours
  • Page controls:
    • Refresh rate indicator: The page refreshes automatically every 5 seconds.
    • Clear all: Clears events from the cache permanently. Note! The cache is common to websites sharing the same web dev key. Thus, if another developer is using the test page, it will clear for them as well. 
    • Pause/start: Pauses automatic refresh. New events don't display until you click start. 
Event table columns
Field Description
Time (UTC) Event time
Event type

Event types are as follows:

  • Events sent by you:
    • EVENT
    • setCustomerUserId
    • pageLoad: Sent by the web SDK each time a page is loaded/refreshed on your website
Event content

The event payload, as recorded by PBA.

Comments
  • Valid: PBA received and recorded the event. No further action is required.
  • Invalid: List of errors requiring corrective action. The error message format is:
    event field name: error description 
  • Hover over error messages to see details:
    PBAWebSDKTestingErrorMessagesPopup_en-us.png

Drill-down view

mceclip0.png

Click an event row to display its contents after processing. See Web SDK event parameters for additional information

Procedures

Complete the procedures that follow.

Enable test mode

Prerequisites

Before testing, the web SDK must be implemented on your website or on a test website.

Browser limitation

If test mode is enabled on a given browser, irrespective of the tab; the browser can only be used to connect to the web site specified and not to any other website. Use a different browser, for example, Safari instead of Chrome, to connect from the same machine to a different web site.

To enable test mode:

  1. Verify that the SDK is loaded:
    1. In AppsFlyer, go to My Apps > View brand bundles.
    2. Select the required Web SDK integration test.
      The integration page opens. The web dev key is displayed.

      pba_web_sdk_integration_test_web_dev_key_en-us.png

    3. In a new browser tab, go to your website (that has the Web SDK installed).
    4. Right-click and select inspect to open the browser developer tools. 
    5. Go to the Console tab.
    6. In the console, enter:
      window.AF_SDK.initPluginsConfig.pba.webAppId

      The webAppID displays.

      testing_pba_integration_webappid_check_en-us.png

    7. Verify that the webAppID is identical to the web dev key in the Web SDK integration test page.
  2. Enable test mode:
    1. In the website browser tab, go to the Console tab.
    2. Enter:
      window.AF_SDK.PLUGINS.PBA.turnOnDevMode()
      The function returns undefined.

      testing_pba_integration_turnondevmode.png

  3. Verify that test mode is enabled:
    • In Console tab, Enter:
      window.AF_SDK.PLUGINS.PBA.isDevModeOn()

      The return value is true. This indicates that test mode is active. 
      PBATestingWebSDKIntegrationIsDevModeOn_en-us.png

Send test events

  • In test mode, events that you send are displayed in the test integration page
  • Note! Test events are processed and subsequently will be included in PBA reports. To avoid distorting reports, populate eventRevenue with low (small) values. If no value is sent, PBA populates it with 0. 

Send example events of each of the types described. 

Step

Action

(Enter commands)

Web SDK test integration page

(Expected result) 

1

Open a new tab in the browser and browse to any page on your website.

PBA registers a 'pageLoad' event whenever your website opens/refreshes:

PBATestingWebSDKPageLoadEvent_en-us.png

2

Login/register to your website as a user to trigger a setCustomerUserId event.

mceclip3.png

3

Start sending web events to verify PBA processes them correctly.

Note:

If not specified, eventRevenue and eventRevenueCurrency are populated with default values:

  • eventRevenueCurrency: "USD"
  • eventRevenue: 0

PBAWebSDKTestEventEVENT_en-us.png

See Web SDK event parameters for additional details.

mceclip5.png

Troubleshooting

Events do not display in the test page

  1. In the browser developer tools, go to Network tab.
  2. In the filter field, enter "websdk."
  3. Based on the HTTP response code, proceed as follows:
    • 200: Reach out to AppsFlyer technical support.
    • 400: Check that all parameters are enclosed in " ". 
Was this article helpful?