Overview
Store Location Detection allows you to identify which App Store or Google Play Store region your user's account belongs to. This is crucial for implementing region-specific features, payment methods, and legal compliance. Unlike GPS location, store location reflects where the user's app store account is registered, ensuring accurate regional feature availability.
Prerequisites
Before implementing store location detection, ensure you have:
-
Installed the Despia plugin from the WeWeb Marketplace
-
Verified installation by checking Assets → Library → look for the book symbol showing "Despia Provider"
Implementation Steps
Step 1: Add the Despia Plugin Component
-
Click the Add button in your WeWeb editor
-
Navigate to the Assets panel
-
Find and drag the Despia plugin element from your asset library
-
Place it at the top of your page
-
Best practice: Keep it as the first element for visibility
-
Works on both new and existing pages
-
Step 2: Access Store Location Variable
The store location is automatically available as a variable once the Despia plugin is added:
-
Select any element where you want to use the store location
-
Make the element's content dynamic (click the binding icon)
-
Navigate to Variables in the binding menu
-
Select Despia plugin → Store Location
The variable returns a two-letter country code (e.g., "US", "GB", "FR", "DE").
Step 3: Implement Conditional Logic
Use the store location variable to show/hide features or modify behavior:
Example: Conditional Button Display
-
Add a button element to your page
-
Go to the button's Settings → Conditional Rendering
-
Create a condition that checks if the store location equals your target region
-
The element will only appear for users in that specific app store region
Store Location Values
The store location returns standard ISO country codes:
Code | Region | Store |
---|---|---|
US | United States | US App Store / Play Store |
GB | United Kingdom | UK App Store / Play Store |
DE | Germany | German App Store / Play Store |
FR | France | French App Store / Play Store |
JP | Japan | Japanese App Store / Play Store |
CN | China | Chinese App Store / Play Store |
And all other ISO 3166-1 alpha-2 country codes.
Platform Behavior
Different behaviors across platforms:
Platform | Behavior |
---|---|
iOS/Android Native | Returns actual App Store / Play Store region |
Web Browser | Falls back to browser language/region settings |
PWA | Uses browser locale as approximation |
Common Use Cases
Payment Method Selection
Show different payment options based on store location:
-
US Store: Enable external payment links to save on commission fees (following legal requirements)
-
EU Store: Display region-appropriate payment methods like SEPA
-
Asian Markets: Show local payment providers like Alipay or LINE Pay
-
Other Regions: Default to standard in-app purchases
Content Restrictions
Comply with regional content laws:
-
Hide certain features in restricted regions
-
Show age verification in specific countries
-
Display required legal disclaimers per region
-
Adjust content ratings based on local requirements
Currency and Pricing
Automatically set appropriate currency and pricing tiers based on the user's store region. This ensures prices display correctly and match what users expect to see in their local app store.
Feature Flags
Enable region-specific features:
-
Roll out beta features to specific markets first
-
Comply with local regulations automatically
-
Enable market-specific partnerships or integrations
-
Show region-exclusive content or promotions
Publishing Changes
-
Make your conditional logic changes in WeWeb
-
Click Publish to deploy
-
Changes apply instantly via over-the-air updates
-
No App Store or Google Play resubmission required
-
All users receive updates immediately
Best Practices
-
Cache the value: Store location rarely changes, so save it to a variable to avoid repeated checks
-
Provide fallbacks: Always have a default behavior for unknown or unexpected regions
-
Test thoroughly: Use test devices with different store regions to verify functionality
-
Document regions: Maintain a clear list of supported regions and their specific features
-
Legal compliance: Consult legal advice for region-specific requirements before implementation
-
User communication: Clearly explain why certain features may vary by region when relevant
Important Considerations
Legal Compliance
Understanding store location is critical for legal compliance. For example, recent legal actions require that US App Store users must be allowed to use external payment methods, potentially saving 30% in commission fees. EU users have GDPR requirements, while some Asian markets have specific content restrictions.
User Experience
Remember that store location is different from physical location. A user traveling abroad will maintain their home store region. This means an American user vacationing in France will still see US App Store features. Changing store regions requires users to modify their Apple or Google account settings, which most users rarely do.
Troubleshooting
-
Variable not appearing: Ensure Despia plugin component is on the page
-
Wrong region detected: In web preview, the system uses browser locale instead of actual store location
-
Conditional not working: Double-check your condition formula and ensure you're comparing against the correct country code
-
Testing different regions: Use test devices with different store accounts or simulator settings
Example Implementation Scenarios
External Payment Options
When building an app with subscription services, you might want to offer US users the option to pay outside the app to avoid Apple's 30% commission. You would check if the store location equals "US" and conditionally show a "Pay with Stripe" button that opens an external payment page, while users from other regions only see the standard in-app purchase option.
Regional Feature Rollout
If launching a new social feature, you might want to test it in a smaller market first. You could check if the store location is "CA" (Canada) and only show the new feature to Canadian users while gathering feedback before a global rollout.
Compliance-Based Restrictions
For apps with user-generated content, certain regions may require additional moderation or age verification. You could check the store location and automatically enable stricter content filters or age gates for regions with such requirements.
For additional support or questions, please contact our support team at support@despia.com