### Android (Java) Setup Source: https://docs.web2wave.com/reference/embedding-quizzes-and-paywalls-into-mobile-apps Information on the setup process for the Web2Wave Java SDK after installation. ```APIDOC ## Android (Java) Setup ### Description Once the Web2Wave Java SDK dependency is added to your project, it is ready for use. No explicit initialization is required for basic WebView functionality. ### Initialization No explicit initialization method is required. The SDK is ready to use after adding the dependency. ``` -------------------------------- ### Complete Implementation Example Source: https://docs.web2wave.com/reference/embed-funnels-into-iframe A full HTML document demonstrating both the iframe embedding and the event listener setup. ```html Embedded Quiz

My Embedded Quiz

``` -------------------------------- ### Multi-Language Scenario Setup Source: https://docs.web2wave.com/reference/auto-redirect-user-guide-language-country-based-redirects Example setup for redirecting users to their browser language version of a quiz. ```text 1. Main: "Fitness Quiz" (English, Auto: Redirect by language) 2. Translation: "Fitness Quiz (German)" (German, Source: Main) 3. Translation: "Fitness Quiz (French)" (French, Source: Main) ``` -------------------------------- ### Install Web2Wave via CocoaPods Source: https://docs.web2wave.com/reference/embedding-quizzes-and-paywalls-into-mobile-apps Add the dependency to your Podfile and execute the installation command. ```ruby pod 'Web2Wave' ``` ```bash pod install ``` -------------------------------- ### Payment Terms Block - Usage Examples Source: https://docs.web2wave.com/reference/payment-terms-block Examples demonstrating how to implement the Payment Terms block with different pricing scenarios, including basic display, free trials, and discount information. ```APIDOC ## Payment Terms Block - Usage Examples ### Basic Payment Terms ```html

You will be charged $9.99 every month until you cancel.

``` ### With Free Trial ```html

Start your 7 days free trial, then $9.99 per month.

``` ### With Discount Information ```html

$19.99 $9.99 (Save 50%) per month

``` ``` -------------------------------- ### Android (Java) Installation Source: https://docs.web2wave.com/reference/embedding-quizzes-and-paywalls-into-mobile-apps Instructions for adding the Web2Wave Java SDK dependency to your Android project. ```APIDOC ## Android (Java) Installation ### Description Follow these steps to add the Web2Wave Java SDK to your Android project using JitPack. ### Steps 1. **Add JitPack repository to your project's `build.gradle` file:** ```gradle allprojects { repositories { google() mavenCentral() maven { url 'https://jitpack.io' } } } ``` 2. **Add the dependency to your app-level `build.gradle` file:** ```gradle dependencies { implementation 'com.github.web2wave:web2wave_java:1.0.0' } ``` ``` -------------------------------- ### Create Subscription Response Source: https://docs.web2wave.com/reference/custom-external-payment-system Example JSON response for a successful subscription creation, including event data for tracking. ```json { "success": 1, "data": { "id": 12345, "user_id": "...", "payment_system": 8, "pay_system_id": "order_123", "status": "active", "amount": 2999, "currency": "USD", "invoices_new": [ { "id": 1, "subscription_id": 12345, "status": "Paid", "amount": 29.99, "amount_usd": 29.99, "date": "2025-02-24 12:00:00" } ] }, "event_name": "Subscribe", "event_properties": { "currency": "USD", "value": "29.99", "price_id": 123, "has_subscription": "1", "paywall_id": "456", "is_skip_send_events": false, "subscription_id": 12345, "price_id_internal": 123 } } ``` -------------------------------- ### Create Subscription cURL Request Source: https://docs.web2wave.com/reference/custom-external-payment-system Example cURL command to create a subscription via the API. ```bash curl -X POST "https://YOUR_PROJECT_DOMAIN/api/subscription" \ -H "Content-Type: application/json" \ -H "api_key: YOUR_API_KEY" \ -d '{ "payment_system": 8, "pay_system_id": "order_123", "plan_id": "my_plan", "price_id": 123, "amount": 2999, "currency": "USD", "customer": "cust_1", "subscription_invoices": [{ "amount": 29.99 }] }' ``` -------------------------------- ### Multi-Currency Paywall Structure Source: https://docs.web2wave.com/reference/auto-redirect-user-guide-language-country-based-redirects Example structure for setting up country-based redirects for localized paywalls with different currencies. ```text Main Paywall (USD) → Redirects to: ├── EU Paywall (EUR, Country: DE) ├── UK Paywall (GBP, Country: GB) └── Canada Paywall (CAD, Country: CA) ``` -------------------------------- ### Create Invoice cURL Request Source: https://docs.web2wave.com/reference/custom-external-payment-system Example cURL command to create an invoice for an existing subscription. ```bash curl -X POST "https://YOUR_PROJECT_DOMAIN/api/subscription/invoice" \ -H "Content-Type: application/json" \ -H "api_key: YOUR_API_KEY" \ -d '{"subscription_id": 12345, "amount": 19.99}' ``` -------------------------------- ### BMI Calculation Example Source: https://docs.web2wave.com/reference/weight-height-blocks Calculate BMI using existing user properties and update the user profile with the results. ```javascript // Calculate BMI using stored user properties function calculateUserBMI() { const weight = window.user_properties.weight_kg; const height = window.user_properties.height_cm; if (weight && height) { const bmi = w2w.units.calculateBMI(weight, height, 'kg', 'cm'); const bmiInfo = w2w.units.getBMILevelWithDescription(bmi); w2w.setUserProperty('user_bmi', bmi); w2w.setUserProperty('user_bmi_level', bmiInfo.level); w2w.setUserProperty('user_bmi_description', bmiInfo.description); console.log(`BMI: ${bmi} (${bmiInfo.description})`); } } ``` -------------------------------- ### Initialize Adjust, RevenueCat, and Web2Wave SDKs in iOS Source: https://docs.web2wave.com/reference/revenuecat-web2wave-integration Configure the Adjust SDK with your app token and environment. Initialize Purchases with your RevenueCat API key. Set the Web2Wave API key. This setup is crucial for enabling deep linking and user data tracking. ```swift import UIKit import Adjust import Purchases import Web2Wave @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, AdjustDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Purchases.configure(withAPIKey: "your_revenuecat_public_api_key") Web2Wave.shared.apiKey = "your-api-key" let adjustConfig = ADJConfig(appToken: "your_adjust_app_token", environment: ADJEnvironmentProduction) adjustConfig?.delegate = self Adjust.appDidLaunch(adjustConfig) return true } // Handle deferred deep link (user installs app after clicking the web link) func adjustDeferredDeeplinkReceived(_ deeplink: URL?) -> Bool { guard let deeplink = deeplink else { return false } handleDeepLink(deeplink) return true } // Handle direct deep link via Universal Links func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { if userActivity.activityType == NSUserActivityTypeBrowsingWeb, let url = userActivity.webpageURL { if let deeplink = ADJDeeplink(deeplink: url) { Adjust.processDeeplink(deeplink) } handleDeepLink(url) } return true } private func handleDeepLink(_ url: URL) { guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false), let userId = components.queryItems?.first(where: { $0.name == "user_id" })?.value else { print("Failed to extract user_id from deep link") return } print("User ID from deep link: \(userId)") fetchRevenueCatAppUserID(userId: userId) } private func fetchRevenueCatAppUserID(userId: String) { Purchases.shared.getCustomerInfo { customerInfo, error in guard let appUserID = customerInfo?.appUserID else { print("Failed to fetch RevenueCat user info: \(error?.localizedDescription ?? "Unknown error")") return } print("RevenueCat App User ID: \(appUserID)") Task { await self.sendAppUserIDToWeb2Wave(userId, appUserID) } } } private func sendAppUserIDToWeb2Wave(_ userId: String, _ appUserID: String) async { switch await Web2Wave.shared.setRevenuecatProfileID(web2waveUserId: userId, revenueCatProfileID: appUserID) { case .success: print("Successfully sent RevenueCat ID to Web2Wave API") case .failure(let error): print("Error sending data to Web2Wave API: \(error)") } } } ``` -------------------------------- ### Get User Properties Source: https://docs.web2wave.com/reference/get_user-properties Retrieves properties associated with a specific user. Requires a user identifier (email or GUID). ```APIDOC ## GET /api/user/properties ### Description Retrieves properties associated with a specific user. ### Method GET ### Endpoint https://api.web2wave.com/api/user/properties ### Parameters #### Query Parameters - **user** (string) - Required - Email or user GUID ### Request Example ```json { "user": "user@example.com" } ``` ### Response #### Success Response (200) - **user_id** (string) - The unique identifier for the user. - **email** (string) - The email address of the user. - **properties** (array of objects) - A list of user properties. - **property** (string) - The name of the property. - **value** (string) - The value of the property. #### Response Example ```json { "user_id": "123e4567-e89b-12d3-a456-426614174000", "email": "user@example.com", "properties": [ { "property": "theme", "value": "dark" } ] } ``` #### Error Response (404) - **message** (string) - Indicates that no user was found with the provided identifier. ``` -------------------------------- ### Payment Terms with Free Trial Information Source: https://docs.web2wave.com/reference/payment-terms-block This example demonstrates how to display payment terms that include a free trial period. It uses `data-price-fill-toggle` to conditionally show the trial details and `data-price-fill` to populate the trial description. ```html

Start your 7 days free trial, then $9.99 per month.

``` -------------------------------- ### Get Experiment Details API Source: https://docs.web2wave.com/reference/experiments Get full details for a single experiment by its ID. ```APIDOC ## GET /experiments/{id} ### Description Get full details for a single experiment by its ID. ### Method GET ### Endpoint /experiments/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the experiment. ### Response #### Success Response (200) - **experiment** (object) - An object containing the full details of the experiment. - **id** (string) - The unique identifier for the experiment. - **name** (string) - The name of the experiment. - **type** (string) - The type of the experiment. - **status** (string) - The current status of the experiment. - **slug** (string) - The slug of the quiz or paywall the experiment is running on. - **variants** (array) - A list of variants for the experiment. - **filters** (object) - Filters applied to the experiment. #### Response Example { "experiment": { "id": "exp_123", "name": "Headline Test", "type": "quiz", "status": "active", "slug": "my-quiz", "variants": [ { "name": "Control", "weight": 50 }, { "name": "Variant A", "weight": 50 } ], "filters": { "country": "US" } } } ``` -------------------------------- ### Initialize SDKs and Handle Deeplinks in Swift Source: https://docs.web2wave.com/reference/direct-web2wave-integration Initializes Adapty, AppsFlyer, and Web2Wave SDKs. Handles deeplinks to extract user IDs and fetches subscription status. Stores user ID locally using UserDefaults. ```swift import UIKit import AppsFlyerLib import Adapty import Web2Wave class ViewController: UIViewController, DeepLinkDelegate { var userId: String? override func viewDidLoad() { super.viewDidLoad() // Initialize SDKs Adapty.activate("your_adapty_public_sdk_key") AppsFlyerLib.shared().deepLinkDelegate = self AppsFlyerLib.shared().start() // Load user ID from local storage if available if let userId = UserDefaults.standard.string(forKey: "userId") { fetchSubscriptionStatus(userId: userId) } } // AppsFlyer deep link delegate method func didResolveDeepLink(_ result: DeepLinkResult) { guard case .found = result.status, let deepLink = result.deepLink else { return } handleDeepLink(deepLink: deepLink) } // Parses deep link to extract user ID and fetch subscription status private func handleDeepLink(deepLink: DeepLink) { guard let deepLinkValue = deepLink["deep_link_value"] as? String, let data = deepLinkValue.data(using: .utf8), let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any], let extractedUserId = json["user_id"] as? String else { return } self.userId = extractedUserId UserDefaults.standard.set(extractedUserId, forKey: "userId") fetchSubscriptionStatus(userId: extractedUserId) } // Fetches subscription status using Web2Wave SDK private func fetchSubscriptionStatus(userId: String) async { let isActive = await Web2Wave.shared.hasActiveSubscription(userID: userId) DispatchQueue.main.async { isActive ? self.providePaidContent() : self.showPaywall() } } // Provides paid content to the user private func providePaidContent() { print("User has an active subscription. Providing access to paid content.") } // Shows the paywall to the user private func showPaywall() { print("No active subscription. Displaying paywall.") } // Example usage of Web2Wave library methods private func web2WaveExamples() async { guard let userId = userId else { return } // Fetch user properties let properties = await Web2Wave.shared.fetchUserProperties(userID: userId) print("User properties: \(String(describing: properties))") // Update a user property let updateResult = await Web2Wave.shared.updateUserProperty( userID: userId, property: "theme", value: "dark" ) if case .failure(let error) = updateResult { print("Failed to update user property: \(error)") } // Set Adapty Profile ID let adaptyResult = await Web2Wave.shared.setAdaptyProfileID( appUserID: userId, adaptyProfileID: "example_adapty_id" ) if case .failure(let error) = adaptyResult { print("Failed to save Adapty profile ID: \(error)") } } } ``` -------------------------------- ### User Property Webhook Example Source: https://docs.web2wave.com/reference/webhook-formats Example payload for the user_property event type, triggered when user properties are added or modified. ```json { "type": "user_property", "data": { "project_domain": "app.web2wave.com", "user_id": "f555ab28-a2b8-447d-9fe9-3c17e6ac70f4", "property": "2_question", "value": "Of course, yes" } } ``` -------------------------------- ### Initialize Web2Wave SDK and Set Up App (Dart) Source: https://docs.web2wave.com/reference/direct-web2wave-integration This Dart snippet initializes the Web2Wave SDK with an API key and sets up the main application widget. It ensures Flutter is initialized before running the app. ```dart import 'package:flutter/material.dart'; import 'package:web2wave/web2wave.dart'; import 'package:shared_preferences/shared_preferences.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); Web2Wave.shared.initialize(apiKey: 'your-api-key'); runApp(MyApp()); } ``` -------------------------------- ### Conditional Override Example: Button Text Source: https://docs.web2wave.com/reference/conditional-logic-for-fields-and-screens This example demonstrates changing button text based on a user's answer to a specific screen. Ensure the condition property and value accurately reflect your user flow. ```text screen-abc123 == yes ``` -------------------------------- ### GET /subscription/invoices Source: https://docs.web2wave.com/reference/get_subscription-invoices Retrieve a list of all client invoices. ```APIDOC ## GET /subscription/invoices ### Description Fetch all invoices for a client based on the payment system. Supports Stripe, Paddle, PayPal, and Primer payment systems. ### Method GET ### Endpoint /subscription/invoices ### Parameters #### Query Parameters - **pay_system_id** (string) - Required - ID of the subscription in external Stripe/Paddle/PayPal/Primer, e.g. sub_1PzNJzCsRq5tBi2bbfNsAf86or I-H7HC902MYM49 - **limit** (integer) - Optional - Number of records to retrieve (default: 100, max: 1000). - **offset** (string) - Optional - Pagination offset using the ID of the last invoice on the page. For Stripe: starting_after parameter, for Paddle: after parameter. ### Response #### Success Response (200) - **success** (integer) - Indicates success. - **error** (integer) - Indicates error. - **data** (array) - Array of invoice objects. Structure varies by payment system. #### Response Example ```json { "success": 1, "error": 0, "data": [ { "invoice_id": "inv_123", "amount": 1000, "currency": "USD", "status": "paid" } ] } ``` #### Error Response (400) - **error** (integer) - Indicates error. - **error_msg** (string) - Error message description. #### Error Response Example ```json { "error": 1, "error_msg": "cloud payment is not setup" } ``` ``` -------------------------------- ### GET /websites/web2wave/visits Source: https://docs.web2wave.com/reference/get_user-user-visits Retrieves a list of visits for a specific user. ```APIDOC ## GET /websites/web2wave/visits ### Description Retrieve a list of visits for a specific user, including UTM parameters, device details, and geographic location for each visit. ### Method GET ### Endpoint /websites/web2wave/visits ### Parameters #### Query Parameters - **userId** (string) - Required - The unique identifier of the user whose visits are to be retrieved. ### Response #### Success Response (200) - **visits** (array) - A list of visit objects. - **visitId** (string) - The unique identifier for the visit. - **timestamp** (string) - The date and time of the visit (ISO 8601 format). - **utmParameters** (object) - An object containing UTM parameters. - **source** (string) - The UTM source. - **medium** (string) - The UTM medium. - **campaign** (string) - The UTM campaign. - **device** (object) - An object containing device details. - **type** (string) - The type of device (e.g., 'desktop', 'mobile'). - **os** (string) - The operating system of the device. - **browser** (string) - The browser used. - **geoLocation** (object) - An object containing geographic location data. - **country** (string) - The country of the visitor. - **city** (string) - The city of the visitor. #### Response Example ```json { "visits": [ { "visitId": "v123", "timestamp": "2023-10-27T10:00:00Z", "utmParameters": { "source": "google", "medium": "cpc", "campaign": "fall_promo" }, "device": { "type": "desktop", "os": "Windows 10", "browser": "Chrome" }, "geoLocation": { "country": "USA", "city": "New York" } } ] } ``` ``` -------------------------------- ### Embed Meta Ads Video Tutorial Source: https://docs.web2wave.com/reference/ads-launch-pixels HTML snippet to embed a Loom video tutorial for Meta Ads setup. ```html
``` -------------------------------- ### GET /websites/web2wave Source: https://docs.web2wave.com/reference/get_paywalls Retrieves paywall information for a given website. ```APIDOC ## GET /websites/web2wave ### Description Retrieves paywall information associated with a website. ### Method GET ### Endpoint /websites/web2wave ### Parameters #### Query Parameters - **url** (string) - Required - The URL of the website to check for paywalls. ### Response #### Success Response (200) - **success** (integer) - Indicates the success of the operation. Typically 1 for success. - **paywalls** (array) - A list of paywall objects associated with the website. - Each item in the array is a Paywall object (structure not detailed in the provided text). #### Response Example ```json { "success": 1, "paywalls": [ { "paywall_id": "pw_123", "type": "subscription", "name": "Premium Access" } ] } ``` ``` -------------------------------- ### Kotlin: Integrate AppsFlyer, RevenueCat, and Web2Wave Source: https://docs.web2wave.com/reference/revenuecat-web2wave-integration Initializes SDKs and registers a deep link listener to process incoming deep links. Requires API keys for AppsFlyer, RevenueCat, and Web2Wave. ```Kotlin import android.content.Context import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import com.appsflyer.AppsFlyerLib import com.appsflyer.deeplink.DeepLink import com.appsflyer.deeplink.DeepLinkListener import com.revenuecat.purchases.Purchases import com.revenuecat.purchases.PurchasesConfiguration import com.revenuecat.purchases.CustomerInfo import com.revenuecat.purchases.interfaces.ReceiveCustomerInfoCallback import kotlinx.coroutines.* import web2wave.Web2Wave import org.json.JSONObject class MainActivity : AppCompatActivity() { private val scope = CoroutineScope(Dispatchers.IO) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Web2Wave.initWith("YOUR_API_KEY_TO_WEB2WAVE") // Initialize RevenueCat Purchases.configure(PurchasesConfiguration.Builder(this, "your_revenuecat_public_api_key").build()) AppsFlyerLib.getInstance().apply { init("yourAppsFlyerDevKey", null, this@MainActivity) start(this@MainActivity) registerConversionListener(this@MainActivity, object : DeepLinkListener { override fun onDeepLinking(deepLink: DeepLink?) { deepLink?.deepLinkValue?.let { handleDeepLink(it) } } override fun onAttributionFailure(error: String?) { println("Failed deep link: $error") } }) } getSharedPreferences("prefs", Context.MODE_PRIVATE) .getString("userId", null)?.let { fetchSubscriptionStatus(it) } } private fun handleDeepLink(deepLinkValue: String) { runCatching { JSONObject(deepLinkValue).getString("user_id").also { ``` -------------------------------- ### GET /websites/web2wave/paywall Source: https://docs.web2wave.com/reference/get_paywalls-paywallid Retrieves the paywall information for a given website. ```APIDOC ## GET /websites/web2wave/paywall ### Description Retrieves the paywall information for a given website. ### Method GET ### Endpoint /websites/web2wave/paywall ### Response #### Success Response (200) - **success** (integer) - Indicates if the operation was successful. - **paywall** (Paywall) - The paywall object containing details about the paywall. ### Response Example ```json { "success": 1, "paywall": { "id": "paywall_123", "name": "Default Paywall", "type": "subscription", "price": { "amount": 9.99, "currency": "USD" } } } ``` ``` -------------------------------- ### GET /paywalls Source: https://docs.web2wave.com/reference/get_paywalls Retrieve a list of paywalls associated with the authenticated account. ```APIDOC ## GET /paywalls ### Description List all paywalls available for the authenticated user. ### Method GET ### Endpoint /paywalls ### Parameters #### Query Parameters - **with_deleted** (boolean) - Optional - Include soft-deleted paywalls in the response. ### Response #### Success Response (200) - **paywalls** (array) - A list of paywall objects. ``` -------------------------------- ### Swift: Integrate AppsFlyer, RevenueCat, and Web2Wave Source: https://docs.web2wave.com/reference/revenuecat-web2wave-integration Initializes SDKs and handles deep links to extract user IDs and send them to the Web2Wave API. Requires configuration of API keys for each service. ```Swift import UIKit import AppsFlyerLib import Purchases import Web2Wave class ViewController: UIViewController, DeepLinkDelegate { var userId: String? override func viewDidLoad() { super.viewDidLoad() Purchases.configure(withAPIKey: "your_revenuecat_public_api_key") // Initialize RevenueCat AppsFlyerLib.shared().deepLinkDelegate = self AppsFlyerLib.shared().start() // Set up AppsFlyer SDK Web2Wave.shared.apiKey = "your-api-key" // Configure Web2Wave SDK } func didResolveDeepLink(_ result: DeepLinkResult) { if case .found = result.status, let deepLink = result.deepLink { handleDeepLink(deepLink) } else { print("Deep link not found or failed: \(String(describing: result.error))") } } private func handleDeepLink(_ deepLink: DeepLink) { guard let deepLinkValue = deepLink["deep_link_value"] as? String, let userData = deepLinkValue.data(using: .utf8), let userDict = try? JSONSerialization.jsonObject(with: userData) as? [String: Any], let extractedUserId = userDict["user_id"] as? String else { print("Failed to parse deep_link_value") return } userId = extractedUserId print("User ID from deep link: \(extractedUserId)") fetchRevenueCatAppUserID() } private func fetchRevenueCatAppUserID() { Purchases.shared.getCustomerInfo { customerInfo, error in guard let appUserID = customerInfo?.appUserID else { print("Failed to fetch RevenueCat user info: \(error?.localizedDescription ?? "Unknown error")") return } print("RevenueCat App User ID: \(appUserID)") if let userId = self.userId { Task { await self.sendAppUserIDToWeb2Wave(userId, appUserID) } } } } private func sendAppUserIDToWeb2Wave(_ userId: String, _ appUserID: String) async { switch await Web2Wave.shared.setRevenuecatProfileID(web2waveUserId: userId, revenueCatProfileID: appUserID) { case .success: print("Successfully sent RevenueCat ID to Web2Wave API") case .failure(let error): print("Error sending data to Web2Wave API: \(error)") } } } ``` -------------------------------- ### Integrate Web2Wave with Adjust and RevenueCat in Android Source: https://docs.web2wave.com/reference/revenuecat-web2wave-integration Implementation for MainActivity in Android using Kotlin. Requires initializing Web2Wave, RevenueCat, and Adjust, and handling deep links to sync user IDs. ```kotlin import androidx.appcompat.app.AppCompatActivity import com.adjust.sdk.Adjust import com.adjust.sdk.AdjustConfig import com.adjust.sdk.OnDeferredDeeplinkResponseListener import com.revenuecat.purchases.CustomerInfo import com.revenuecat.purchases.Purchases import com.revenuecat.purchases.PurchasesConfiguration import com.revenuecat.purchases.PurchasesError import com.revenuecat.purchases.interfaces.ReceiveCustomerInfoCallback import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import web2wave.Web2Wave class MainActivity : AppCompatActivity() { private val scope = CoroutineScope(Dispatchers.IO) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Web2Wave.initWith("YOUR_API_KEY_TO_WEB2WAVE") Purchases.configure(PurchasesConfiguration.Builder(this, "your_revenuecat_public_api_key").build()) val adjustConfig = AdjustConfig(this, "your_adjust_app_token", AdjustConfig.ENVIRONMENT_PRODUCTION) adjustConfig.setOnDeferredDeeplinkResponseListener(OnDeferredDeeplinkResponseListener { deeplink -> deeplink?.let { handleDeepLink(it) } true // return true to open the deep link }) Adjust.onCreate(adjustConfig) // Handle direct deep link if app was opened via intent intent?.data?.let { handleDeepLink(it) } } override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) intent.data?.let { handleDeepLink(it) } Adjust.onNewIntent(intent) } private fun handleDeepLink(uri: Uri) { val userId = uri.getQueryParameter("user_id") if (userId.isNullOrEmpty()) { println("Failed to extract user_id from deep link") return } println("User ID from deep link: $userId") fetchRevenueCatProfileID(userId) } private fun fetchRevenueCatProfileID(userId: String) { Purchases.sharedInstance.getCustomerInfo(object : ReceiveCustomerInfoCallback { override fun onReceived(customerInfo: CustomerInfo) { val revenueCatProfileID = customerInfo.appUserID scope.launch { Web2Wave.setRevenuecatProfileID(userId, revenueCatProfileID) } } override fun onError(error: PurchasesError) { println("Failed to fetch RevenueCat user info: ${error.message}") } }) } } ``` -------------------------------- ### GET /quizzes/screens-version Source: https://docs.web2wave.com/reference/get_quizzes-screens-version Retrieve the screens configuration for a specific version of a quiz. ```APIDOC ## GET /quizzes/screens-version ### Description Retrieve the screens configuration for a specific version of a quiz. ### Method GET ### Endpoint /quizzes/screens-version ### Parameters #### Query Parameters - **quiz_id** (integer) - Required - The ID of the quiz - **version** (integer) - Required - The version number to retrieve ### Response #### Success Response (200) - **success** (integer) - Status indicator - **screens** (object) - The quiz screens configuration for the specified version #### Response Example { "success": 1, "screens": {} } #### Error Response (422) - **error** (integer) - Error indicator - **error_msg** (string) - Description of the validation error ``` -------------------------------- ### Example User Properties Table Data Source: https://docs.web2wave.com/reference/export-events-user_properties-to-external-db Illustrates the structure and typical data stored in the `user_properties` table, including user identifiers, property names, and their values. ```text id | created_at | updated_at | project_domain | user_id | property | value ---|---------------------|---------------------|-------------------|---------|-------------|------------------ 1 | 2024-01-15 10:30:00 | 2024-01-15 10:30:00 | example.com | user123 | email | user@example.com 2 | 2024-01-15 10:30:00 | 2024-01-15 10:30:00 | example.com | user123 | utm_source | google 3 | 2024-01-15 10:30:00 | 2024-01-15 10:30:00 | example.com | user123 | utm_medium | cpc 4 | 2024-01-15 10:31:00 | 2024-01-15 10:35:00 | example.com | user123 | subscription_status | active ``` -------------------------------- ### GET /quizzes/screens Source: https://docs.web2wave.com/reference/get_quizzes-screens Retrieve the current screens configuration for a specific quiz. ```APIDOC ## GET /quizzes/screens ### Description Retrieve the current screens configuration for a specific quiz. ### Method GET ### Endpoint /quizzes/screens ### Parameters #### Query Parameters - **quiz_id** (integer) - Required - The ID of the quiz #### Request Body None ### Request Example None ### Response #### Success Response (200) - **success** (integer) - Indicates if the request was successful. - **screens** (object) - The quiz screens configuration. #### Response Example ```json { "success": 1, "screens": {} } ``` #### Error Response (422) - **error** (integer) - Indicates an error occurred. - **error_msg** (string) - A message describing the validation error. #### Response Example ```json { "error": 1, "error_msg": "The selected quiz id is invalid." } ``` ``` -------------------------------- ### GET /paywalls/{paywallId} Source: https://docs.web2wave.com/reference/get_paywalls-paywallid Retrieves the details of a specific paywall by its ID. ```APIDOC ## GET /paywalls/{paywallId} ### Description Retrieves the configuration details for a specific paywall identified by the provided ID. ### Method GET ### Endpoint /paywalls/{paywallId} ### Parameters #### Path Parameters - **paywallId** (integer) - Required - The unique identifier of the paywall. #### Header Parameters - **api_key** (string) - Required - The API key for authentication. ### Response #### Success Response (200) - **Paywall** (object) - The paywall object containing details such as id, project_id, slug, name, payment_system, and associated settings. ``` -------------------------------- ### Swift Project Dependencies and Initialization Source: https://docs.web2wave.com/reference/adapty-web2wave-integration Defines project dependencies for Swift and initializes Adapty and Adjust SDKs. The Adjust SDK is configured to launch deferred deep links. ```swift dependencies: [ .package(url: "https://github.com/web2wave/web2wave_swift.git", from: "1.0.0") ] import UIKit import Adapty import Adjust import Web2Wave class ViewController: UIViewController, AdjustDelegate { override func viewDidLoad() { super.viewDidLoad() Adapty.activate("your_adapty_public_sdk_key") let config = ADJConfig(appToken: "YOUR_ADJUST_APP_TOKEN", environment: ADJEnvironmentSandbox) config?.delegate = self config?.launchDeferredDeeplink = true Adjust.appDidLaunch(config) } func adjustDeeplinkResponse(_ deeplink: URL?) -> Bool { guard let url = deeplink, let value = URLComponents(url: url, resolvingAgainstBaseURL: false)? .queryItems?.first(where: { $0.name == "deep_link_value" })?.value, let data = value.data(using: .utf8), let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any], let userId = json["user_id"] as? String else { return false } Adapty.getProfile { profile, _ in ``` -------------------------------- ### GET /paywalls/screens-version Source: https://docs.web2wave.com/reference/get_paywalls-screens-version Retrieve the screens configuration for a specific version of a paywall. ```APIDOC ## GET /paywalls/screens-version ### Description Retrieve the screens configuration for a specific version of a paywall. ### Method GET ### Endpoint /paywalls/screens-version ### Parameters #### Query Parameters - **paywall_id** (integer) - Required - The ID of the paywall - **version** (integer) - Required - The version number to retrieve ### Response #### Success Response (200) - **success** (integer) - Status indicator - **screens** (object) - The paywall screens configuration for the specified version #### Response Example { "success": 1, "screens": {} } ``` -------------------------------- ### Initialize AppsFlyer and Handle Deeplinks in Kotlin Source: https://docs.web2wave.com/reference/direct-web2wave-integration Initializes Web2Wave and AppsFlyer SDKs. Implements the DeepLinkListener to process incoming deeplinks and extract user information for further processing. ```kotlin import android.content.Context import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import com.appsflyer.AppsFlyerLib import com.appsflyer.deeplink.DeepLink import com.appsflyer.deeplink.DeepLinkListener import kotlinx.coroutines.* import web2wave.Web2Wave import org.json.JSONObject class MainActivity : AppCompatActivity() { private val scope = CoroutineScope(Dispatchers.IO) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Web2Wave.initWith("YOUR_API_KEY_TO_WEB2WAVE") AppsFlyerLib.getInstance().apply { init("yourAppsFlyerDevKey", null, this@MainActivity) start(this@MainActivity) registerConversionListener(this@MainActivity, object : DeepLinkListener { override fun onDeepLinking(deepLink: DeepLink?) { ``` -------------------------------- ### Get User Subscriptions Source: https://docs.web2wave.com/reference/get_user-subscriptions Retrieves a list of subscriptions associated with a specific user. ```APIDOC ## GET /websites/web2wave/users/{user_id}/subscriptions ### Description Retrieves a list of subscriptions associated with a specific user. ### Method GET ### Endpoint /websites/web2wave/users/{user_id}/subscriptions ### Parameters #### Path Parameters - **user_id** (string) - Required - A unique identifier for the user. ### Response #### Success Response (200) - **user_id** (string) - A unique identifier for the user associated with the subscription. - **user_email** (string) - The user's email address. - **subscription** (array) - List of subscriptions associated with the user. #### Response Example ```json { "user_id": "c1409762-d624-4a47-a330-2a21d108b681", "user_email": "xxxxx@gmail.com", "subscription": [ { "subscription_id": "sub_123", "plan_name": "Basic", "start_date": "2023-01-01", "end_date": "2024-01-01" } ] } ``` #### Error Response (404) - **message** (string) - Indicates that no user was found with the provided ID. ```