LogoLogo
My AppsLive demoNewsArticles
  • Introduction
  • 📌Product updates: 2025
    • 2024
    • 2023
  • Getting Started
    • Registration
    • Adding a space
    • Adding an app to the space
  • Basic Events & Custom Events
  • Integration
    • Expert Tips
      • What to track
      • Payments & Anti-cheat
      • Check your integration
    • Integration of SDK 2.0+
      • SDK Integration
        • Android
        • iOS
        • macOS
        • Windows
        • Web
          • Web SDK Integration
          • Web SDK Releases
        • Unity
        • Unreal Engine
        • Godot Engine
      • Automatic payment tracking
        • App Store
        • Google Play
      • Setting up Events
        • Basic methods
        • Secondary methods
        • User profile
        • Anticheat methods
        • Track sessions
      • Push notifications
        • Android
        • iOS
        • Windows (UWP)
        • Unity
          • Android
          • iOS
          • Windows (UWP/WSA)
        • Unreal Engine
      • A/B testing
        • Description of A/B testing on the SDK side
        • Working with A/B tests in the devtodev interface
        • A/B testing examples
    • Integration of SDK 1.0+ (deprecated)
      • SDK Integration
        • iOS
        • Android
        • Windows 8.1 and 10
        • Web
        • Unity
        • Mac OS
        • Adobe Air
        • UE4
      • Setting up Events
        • Basic methods
        • Secondary methods
        • User profile
        • Anti-cheat Methods
      • Push Notifications
        • IOS
        • Android
        • Windows 8.1 and Windows 10
        • Unity
        • Abode Air
        • UE4
    • Test Devices
    • Server API
      • Data API 2.0
      • Subscription API
      • Push API
        • IOS
        • Android
        • Windows UWP
        • Windows
      • Raw Export
      • Labels API
      • Data API
    • Import historical data via API
    • Data Export
      • Data Export to Cloud Storage (BigQuery / Amazon S3)
  • 3rd Party Sources
    • Attribution Trackers
      • AppsFlyer
      • Adjust
      • Branch.io
      • Kochava
      • Tenjin
      • Tune (MAT)
      • Singular
      • Custom postback API
      • Facebook Ads referral decryption
    • App Marketplace Data
      • App Store Connect Stats
      • App Store Subscriptions
      • Google Play Console Stats
      • Google Play Subscriptions
      • AppGallery Connect Stats
    • Ad revenue
      • AdColony
      • AdMob
      • Facebook
      • MoPub
      • Unity Ads
      • Vungle
      • Ad revenue API
    • Cohort export
  • Reports and Functionality
    • Space-related Reports and Functionality
      • Overview
      • Custom dashboards & Reports
      • SQL
        • SQL tips
        • SQL Query examples
      • Audience overlap
    • Project-related Reports and Functionality
      • Overview
        • Real-Time Dashboard
        • Acquisition reports
        • Engagement reports
        • Monetization reports
        • In-game analysis reports
        • Cohort analysis
      • Reports
      • Push Notifications
        • Android Notifications
        • IOS Notifications
        • Windows Notifications
        • Button Templates
      • Predictions
      • Users & Segments
      • Filters
      • A/B Testing
      • Tuning
      • Settings
  • Metrics and Glossary
    • Ad networks metrics
    • Market Metrics
    • Prediction Metrics
    • SDK Metrics
    • Subscription metrics
  • Space Management
  • User Profile Management
  • Limits
  • Scenarios and Best Practices
    • Analytics use cases
    • Match-3
    • MMORPG Games
    • Hyper-Casual games
    • Social Casino
    • RPG games
    • Farming games
    • Non-gaming app
    • Acquisition Example
  • FAQ
    • Identification
    • Raw Data
    • All about data discrepancies
  • Slack
Powered by GitBook
On this page
  • Initialization
  • Cross-platform application Initialization
  • Additional initialization
  • User data initialization
  • Application data initialization
  • Debug mode

Was this helpful?

Export as PDF
  1. Integration
  2. Integration of SDK 1.0+ (deprecated)
  3. SDK Integration

Web

PreviousWindows 8.1 and 10NextUnity

Last updated 17 days ago

Was this helpful?

This generation of SDK is deprecated and is no longer supported. Information about the .

Please do the following to integrate your web application with devtodev:

  1. Add the application to the Space using the wizard for adding application.

  2. To integrate SDK, add the following line to the tag of your page:

<script type="text/javascript" src="https://cdn.devtodev.com/sdk/web/v1/devtodevsdk.js">
</script>

Initialization

In order for SDK for WEB to start working, it is necessary to perform initialization right after the page is loaded and you have a basic user identifier at your disposal.

/**
* @param {string} apiKey - devtodev API key, unique API key can be found in the application
* settings ("Settings" → "SDK" → "Integration")
* @param {string} userId - Unique user identifier.
* For example, user’s ID in a social network, or a unique account name used
* for user identification on your server.
* @param {string} previousUserId - Previous unique user identifier. Optional.
* It is used in case of change of the user identifier.
*/

devtodev.init(apiKey, userId, previousUserId);

In case User ID is changed after SDK was initiated, the method should be called repeatedly with indication of a new User ID. For example, when user signs into another account in a launched messenger application.

If a user has no unique identifier, e.g. if it is possible to use your application / site without authorization), but you need to get stats for such users, don't set userId during the initialization or set an empty string ("") or null as value of userId. SDK will assign the unique identifier to the user. This identifier will be used until the real identifier assigns to the user.

Unique API key can be found in the application settings: "Settings" → "SDK" → "Integration".

Cross-platform application Initialization

In cross-platform applications, the additional user identifier can be used. It is a user cross-platform ID which is unique for all of the platforms. And if a cross-platform ID differs from the ID that is main for the platform, you need to set the cross-platform ID. The cross-platform ID combines the user data for a cross-platform project.

We recommend you apply this method before the SDK initialization, otherwise, the user identifier from the previous session will be used since the SDK initialization moment till the setCrossplatformUserId method call.

If it is difficult to do, set a cross-platform ID as soon as it is available in the application after SDK initialization.

/**
* Initializes the user with the specified cross-platform identifier
* @param {string} сrossplatformUserId - unique cross-platform user ID used
* for user identification on your server.
*/

devtodev.setCrossplatformUserId(сrossplatformUserId);

If your application allows user to re-login (changing the user during the working session of application), then the setCrossplatformUserId method should be called just after the authorization. You don't need to call the SDK initialization one more time.

Additional initialization

For the most precise data collection, we strongly recommend specifying some information about the user right after SDK is initiated.

User data initialization

In the first place, this additional initialization is required for gaming applications where the player has a game level as a characteristic.

/**
* Initializes the current user level. Required if level feature used in the app.
* @param {number} currentUserLevel- Сurrent game level of the player.
*/

devtodev.setCurrentLevel(currentUserLevel);

Application data initialization

It is not obligatory, but if you want to have the ability to build reports with regard to the version of your application, use this method before initialization.

/**
* @param {Object} appData - App data object.
* @param {string} appData.appVersion - Current app version. Required.
* @param {number} appData.codeVersion - Current code version. Optional.
*/

devtodev.setAppData(appData);

Debug mode

To enable the debug mode and make SDK notifications displayed in the console, use this method:

/**
* Activates console log
* @param {boolean} status
*/

devtodev.setDebugLog(status);
current version can be found here
Integration samples of devtodev SDK for WEB are available on GitHub.