Testing

We test our campaigns thoroughly before we make them available for use in clients' apps, including end-to-end tests in our own test shopping app. However, there is no way we can simulate the exact environment that your particular app works in, so there is always the possibility that the campaign will work unexpectedly in your app, when it works fine in others (including our test app).

For this reason, we try to make sure we always test new campaigns in the actual apps they will go live in before we release them to the public. We need your help to facilitate this testing.

In order to test a new campaign, we need a way to tell the Contextual Commerce system that it should ignore the standard restrictions that prevent the campaign from showing, and should instead force the campaign-under-test to show. In the world of apps, that means we need you to expose a text field somewhere, so we can enter the campaign ID, and a button to trigger the action.

Most clients add this to a special "developer" section in their preferences. Some even hide this section behind magic knowledge (eg: you need to tap on the preferences page five times before the "developer" section will appear).

The UI for this section is up to you, but at minimum, it needs:

  • a way to enter a four or five digit number (usually a text box)
  • some form of confirmation or trigger (usually a button)

Once a tester has entered the campaign ID and clicked the button, you should call the showCampaign(campaignId: string) function with that ID.

Once this is implemented, you and anyone from your organization can also use it to test any known campaign. Your Contextual Commerce Strategist should have access to the IDs of all the active and pending campaigns for your organization.

The Contextual Commerce SDK logs a number of logs at different levels during its operation. We always prefix our logs with [Granify] to make it easy for you to filter them out (or in, if you need to understand what Contextual Commerce is doing).

For example, if you use the showCampaign(campaignId: string) function above, you might find the following entry in your logs:

[Granify] 🟡 warn [consume(data:):65] Force Matching Failure: CampaignFilter::7641 failed has_cart: ["+"] for value: false

This tells you that:

  • You have initiated Force Matching for the CampaignID: 7641 (in this case)
  • The match failed because the campaign has a restriction in place that prevented it from showing
  • Specifically in this case, the campaign requires that the shopper has at least one item in their cart, and the current shopper does not fulfill that requirement.