"Intercept web traffic"
How to intercept web traffic and manipulate webpages?
Apps offers a straightforward method to achieve intercepting web traffic and manipulating web pages. Follow these steps to get started:
Step 1: Enable the "Append App Code Version in User Agent" Toggle
- Access your Apps dashboard.
- Navigate to the Web view settings of the app you wish to configure.
- Turn the toggle on for "Append app code version in User Agent".
Step 2: Add the User-Agent Key in Your Website Header
- Once you enable the toggle, Apps will modify the User-Agent header when loading the web-view in the app's browser. The app will append the APICodeVersion of the app to the User-Agent. For instance, the User-Agent string will look like this: APICodeVersion/1.18.9
To detect this User-Agent in your website’s code, use the following standard PHP syntax: $user\_agent = $\_SERVER\['HTTP\_USER\_AGENT'\];
- Once you have detected the User-Agent using the above PHP code, you can then manipulate your website’s functionality based on the APICodeVersion value to customize how your web content behaves in the app’s web-view.
With the User-Agent string configured, you can manipulate the web page loaded within the app's web view. Depending on your requirements, you can inject custom CSS, add analytics script or implement any other code necessary to customize the user experience within the web view.
Need more help?
If you've worked through this and still need a hand, contact support — we'll dig in with you.