Analytics · Installation

Onesecondbefore supports the following platforms:

Contact support if you would like to receive an SDK on a different platform.

JavaScript · Free, Pro & Enterprise version

<script>
// Onesecondbefore Analytics
(function(o,n,e,s,b,f){osb_queue=n.osb_queue||[];osb=n.osb||function(){osb_queue.push(arguments)};
f=o.createElement('script');f.async=true;f.src=e+'/client/'+s+(b?'/'+b:'')+'.js';
o.currentScript.parentNode.insertBefore(f,o.currentScript.nextSibling);
})(document,window,'${TRACKER_URL}','${ACCOUNT_ID}', '${DEFAULT_SITE_ID}');

// Tracking events go here...
</script>

Make sure to replace the following text with the values that apply to your website. Contact us for guidance.

  • ${TRACKER_URL} replace with your tracker URL, e.g. https://myconsent.onesecondbefore.com
  • ${ACCOUNT_ID} replace with your account ID, e.g. myaccount.sandbox
  • ${DEFAULT_SITE_ID} replace with a default site ID, e.g. mycompany.com

Android · Free, Pro & Enterprise version

Source code

The source code of the Android SDK is released as open source software under the Mozilla Public License.

Installation

Add the following repository and dependency to your app's build.gradle file:

repositories {
    ...
    maven {
        url "https://www.onesecondbefore.com/repository"
    }
}

dependencies {
    ...
    implementation 'com.onesecondbefore.tracker:tracker-android:7.7.0'
}

After installation, consult our mobile reference documentation. Need help? Contact support.

Our IAB TCF Consent Wall can be integrated easily if you take the steps below. We map the purposes and special features as recommended by Google. Supported by SDK version 7.4+.

Steps to take

  1. Implement the Google Analytics for Firebase SDK
  2. Set the default consent states in your app's AndroidManifest.xml (see below)
  3. Add the call back function (see below)

More background info can be found at Google.

Add the default consent states in your app's AndroidManifest.xml in the following way. More info can be found at Google.

Add the following code to integrate Google Consent Mode with the IAB TCF Consent Wall.

// Add callback function to OSB SDK. This function will be called directly after the user has set 
//      the consent in the CMP.
mOsb.addGoogleConsentCallback(consent -> {
    Map consentMap = new HashMap<>();
    consent.forEach((t,s) -> consentMap.put(FirebaseAnalytics.ConsentType.valueOf(t), 
                                            FirebaseAnalytics.ConsentStatus.valueOf(s)));
    mFirebaseAnalytics.setConsent(consentMap);
});

Retrieve Google Consent Mode example

Below is an example of how to retrieve the Google Consent Mode items.

// Directly request Google Consent Mode Payload from the OSB SDK. The SDK stores the given consent, 
//      if no consent has been given yet this function will return an empty map.
public void getGoogleConsentPayload() {
    if (mOsb == null){
        inializeOSB();
    }

    Map consentMap = new HashMap<>();
    mOsb.getGoogleConsentPayload().forEach((t,s) -> consentMap.put(FirebaseAnalytics.ConsentType.valueOf(t), 
                                                                   FirebaseAnalytics.ConsentStatus.valueOf(s)));

    Log.i(TAG, consentMap.toString());
}

iOS · Free, Pro & Enterprise version

Source code

The source code of the iOS SDK is released as open source software under the Mozilla Public License (MPL).

App Store Publication Remarks

  • The Mobile SDK does not generate a request to use the ID for Advertisers (IDFA). If you want to use Onesecondbefore to track the IDFA, you will have to make a request from your app to ask for the permission. Read about the App Tracking Transparence framework for more info.
  • If you decide to request the IDFA, e.g. for advertising purposes, be sure to implement our Consent Management Platform as well. Apple shared an FAQ about how to best deal with a tracking request and a consent manager.

Prerequisites

  • Deployment Target iOS 11 or later.
  • Xcode 10.1 and iOS SDK 11 or later.
  • iPhone, iPad or iPod touch.

Integration via CocoaPods

The OSB SDK can be integrated via CocoaPods.

target '[Your Target Name]' do
pod 'onesecondbefore-tracker'
end

Import the SDK into your code

Use import OSB. We don't require any additional bridging header to use this pod file.

After installation, consult our mobile reference documentation. Need help? Contact support.

Our IAB TCF Consent Wall can be integrated easily if you take the steps below. We map the purposes and special features as recommended by Google. Supported by SDK version 7.4+.

Steps to take

  1. Implement the Google Analytics for Firebase SDK
  2. Set the default consent states in your app's info.plist (see below)
  3. Add the call back function (see below)

More background info can be found at Google.

Add the default consent states in your app's info.plist in the following way. More info can be found at Google.

Callback function

Add the following code to integrate Google Consent Mode with the IAB TCF Consent Wall.

Retrieve Google Consent Mode example

Add the following code to get the Google Consent Mode settings and log them.