opticon 2015 - getting started with the optimizely developer platform

31
#opticon2015 Getting Started with the Optimizely Developer Platform Jon Gaulding Senior SWE, Optimizely [email protected] Josiah Gaskin Senior SWE, Optimizely [email protected]

Upload: optimizely

Post on 02-Aug-2015

157 views

Category:

Business


0 download

TRANSCRIPT

#opticon2015

Getting Started with the Optimizely Developer PlatformJon GauldingSenior SWE, Optimizely

[email protected]

Josiah GaskinSenior SWE, Optimizely

[email protected]

• Growth of the Optimizely developer platform

• Custom integrations

• Optimizely packaged apps

• Building your own packaged apps (sneak peek)

Overview

We’re just getting started.

The Optimizely Platform

1 Year of Mobile SDK Growth

Optimizely

Opticon 2014

Opticon 2015 (present day)

Growth of the REST API(number of endpoints)

Use our APIs directly, wherever you like.

Custom Integrations

The Stats EndpointGET "https://www.optimizelyapis.com/experiment/v1/experiments/1234/stats"

# optimize.ly/stats-api #

Your System

Auto-allocateor

Warehouse dataor

Build custom reportsor

Send notifications

The Stats EndpointGET “https://www.optimizelyapis.com/experiment/v1/experiments/1234/stats”

# optimize.ly/stats-api-demo #

• Bradley (→) wants to get a phone call when a winner is first declared for an experiment

• Let’s see a demo!

The User List Targeting EndpointPOST "https://www.optimizelyapis.com/experiment/v1/projects/456/targeting_lists"

# optimize.ly/list-api #

Your System

CRMor

Data warehouseor

Analytics Provideror

Anything!

● cookies

● query params

● zip codes

The User List Targeting EndpointPOST "https://www.optimizelyapis.com/experiment/v1/projects/456/targeting_lists"

# optimize.ly/list-api-demo #

• Byron (→) wanted to to target an Opticon promotion to certain Optimizely customers

• Queried account IDs from Salesforce matching an account cookie on optimizely.com

• Let’s see a demo!

Example: Experience Delivery

Mobile Custom Integrations

Example: Dialogs

LiveVariableDialogBuilder.javapublic class LiveVariableDialogBuilder extends AlertDialog.Builder {

LiveVariable<String> mMessageVariable;

LiveVariable<String> mTitleVariable;

public LiveVariableDialogBuilder setVariableKey(@NonNull String variableKey) {

mMessageVariable = Optimizely.stringVariable(variableKey + "_message", "");

mTitleVariable = Optimizely.stringVariable(variableKey + "_title", "");

return this;

}

@NonNull @Override

public AlertDialog create() {

if (mMessageVariable != null) { setMessage(mMessageVariable.get()); }

if (mTitleVariable != null) { setTitle(mTitleVariable.get()); }

return super.create();

}

}

MyActivity.java

public class MyActivity extends Activity {

@Override

protected void onCreate(Bundle savedInstanceState) {

// ...

final LiveVariableDialogBuilder salesDialogBuilder =

new LiveVariableDialogBuilder(CodeUIActivity.this)

.setVariableKey("SalesDialog");

button.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

salesDialogBuilder.show();

}

});

}

}

Code once. Use Everywhere!

Optimizely Packaged Apps

Packaged Apps Live Right Now

Target by company demographics Target by Lytics segments

Target by weather conditionsTarget accounts, leads, and contacts

Target by Krux audiences

Packaged Apps Live Right Now

Segment Analytics Results by Optimizely Bucketing

The Salesforce App# optimize.ly/salesforce-app #

● leads

● contacts

● accounts

● opportunities

The Salesforce App# optimize.ly/salesforce-app #

• Built on top of the list targeting API

• Target visitors tied to Salesforce leads, contacts, accounts, or opportunities

• Another way to make this guy a hero! →

• Let’s see it live!

Example: Targeting

Mobile Packaged Apps

Example: Geofenced Targeting

GeofenceTransitionsIntentService.javapublic class GeofenceTransitionsIntentService extends IntentService {

// ...

protected void onHandleIntent(Intent intent) {

GeofencingEvent geofencingEvent = GeofencingEvent.fromIntent(intent);

if (geofencingEvent.getGeofenceTransition() == Geofence.GEOFENCE_TRANSITION_ENTER) {

Geofence fence = geofencingEvent.getTriggeringGeofence();

SharedPreferences prefs = getSharedPreferences("brickandmortar");

int newTotal = prefs.getInt("TOTAL_VISITS", 0) + 1;

Set<String> visitedSet = new HashSet<String>(prefs.getStringSet("VISITED_SET"));

visitedSet.add(fence.getRequestId());

prefs.edit()

.putStringSet("VISITED_SET", visitedSet)

.putInt("TOTAL_VISITS", newTotal)

.apply();

}

}

}

BrickAndMortarPlugin.java

package com.brickandmortar.optimizelyplugins;

public class BrickAndMortarPlugin implements OptimizelyPlugin {

@Override

public String getPluginId() { return "brickandmortar"; }

@Override

public List<String> getRequiredPermissions(Context context) {

return Arrays.asList(Manifest.permission.ACCESS_FINE_LOCATION);

}

@Override

public boolean start(Optimizely optimizely, JSONObject config) {

// Do some setup

}

}

BrickAndMortarPlugin.java

package com.brickandmortar.optimizelyplugins;

public class BrickAndMortarPlugin implements OptimizelyPlugin {

@Override

public String getPluginId() { return "brickandmortar"; }

@Override

public List<String> getRequiredPermissions(Context context) {

return Arrays.asList(Manifest.permission.ACCESS_FINE_LOCATION);

}

@Override

public boolean start(Optimizely optimizely, JSONObject config) {

// Do some setup

}

}

BrickAndMortarPlugin.java

@Override

public boolean start(Optimizely optimizely, JSONObject config) {

// Set up Geofencing triggers

Intent intent = new Intent(this, GeofenceTransitionsIntentService.class);

setResponderForGeofenceEntry(intent);

// Add current data to optimizely

SharedPreferences prefs = mContext.getSharedPreferences("brickandmortar");

int totalVisits = prefs.getInt("TOTAL_VISITS", 0);

Optimizely.setCustomTag("brickandmortar_TotalVisits", Integer.toString(totalVisits));

for (String locationName : prefs.getStringSet("VISITED_SET", Collections.EMPTY_SET)) {

Optimizely.setCustomTag("brickandmortar_Visited_" + locationName, "true");

}

return true;

}

MyActivity.java

public class MyActivity extends Activity {

@Override

public void onCreate(Bundle savedInstanceState) {

// ...

Optimizely.registerPlugin(new BrickAndMortarPlugin(this));

Optimizely.startOptimizely(getString(R.string.api_key), getApplication());

}

}

Targeting Using the BrickAndMortar Integration

Build and distribute packaged apps. Power overwhelming.

Sneak Peek: Building Your Own

Anatomy of an App Packageintegration.yaml + config.yaml

➔ contain standard application data like app IDs, app type, and required settings

functions.py ➔ contain standard server-side logic like how to fetch audience options provided by an

app and how to validate settings

functions.js ➔ when needed, contains standard client-side logic like how to publish third-party

condition data to Optimizely

etc. ➔ you can bundle other files with the package, such as unit tests and API libraries

Key Takeaways

• A rich and ever-expanding set of APIs is available today

• You can use them to address innumerable needs

• Build custom integrations for your own business

• Build and distribute solutions for Optimizely customers at scale

• Packaged apps enable activation and use of application across any number of accounts, within the native Optimizely experience

• We’re putting the power of packaged apps in your hands!

Join Us!We’re eager to help you write and publish custom integrations and packaged apps

Talk to us here at Opticon, or email [email protected]