This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
// Import the Optimizely iOS SDK for Feature Experimentation | |
// import Optimizely | |
class CarouselViewController: UIViewController { | |
// MARK: - Properties | |
// Replace this with the real OptimizelyClient initialization | |
let optimizelyClient = OptimizelyClient(sdkKey: "YOUR_SDK_KEY") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
// Import the Optimizely iOS SDK for Feature Experimentation | |
// import Optimizely | |
class CarouselViewController: UIViewController { | |
// MARK: - Properties | |
// Replace this with the real OptimizelyClient initialization | |
let optimizelyClient = OptimizelyClient(sdkKey: "YOUR_SDK_KEY") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
/** | |
* Maps mParticle event data to Optimizely's Full Stack event format | |
* @param {MParticleEvent} mpEvent - The mParticle event object | |
* @param {Array} eventMap - List of events with their corresponding IDs | |
* @returns {OptimizelyEvent} Formatted Optimizely event payload | |
*/ | |
function createOptimizelyPayload(mpEvent, eventMap) { | |
if (!mpEvent?.data?.custom_event_type) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Install required libraries: | |
- yargs (CLI) | |
- fast-csv (csv parser and writer) | |
- @optimizely/optimizely-sdk (optimizely SDK) | |
The following script takes in the following CLI arguments: | |
sdkKey (str): SDK Key of Optimizely datafile you wish to use | |
csv_file_path (str): The input CSV relative path with the following columns --> "User Identifier", "Bucketing ID", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import optimizely from '@optimizely/optimizely-sdk' | |
import optimizelyLogging from '@optimizely/optimizely-sdk/lib/plugins/logger' | |
import optimizelyEnums from '@optimizely/optimizely-sdk/lib/utils/enums' | |
import cookie from 'cookie' | |
import rp from 'request-promise' | |
import uuidv4 from 'uuid/v4' | |
import { | |
Callback, | |
Handler, | |
CloudFrontRequest, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let axios = require("axios"); | |
let argv = require("yargs").argv; | |
let s3 = require("@auth0/s3"); | |
let fs = require("fs"); | |
let path = require("path"); | |
// let parquet = require('node-parquet'); | |
let appDir = path.dirname(require.main.filename); | |
let decisionsFiles = []; | |
let eventsFiles = []; | |
//require('s3-upload-resume'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BEGIN: Initialize Optimizely Event Push | |
function dispatchOptimizelyEvent(payload, eventID, eventKey) { | |
var xmlhttp = new XMLHttpRequest(); | |
xmlhttp.onreadystatechange = function() { | |
if (xmlhttp.readyState == 4) { // request finished and response is ready | |
if(xmlhttp.status == 204) { | |
console.log('Fired event to Optimizely: ', eventKey); | |
} else { | |
console.log('Failed to dispatch Optimizely event: ', xmlhttp.responseText); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
How to use: | |
Step 1: line 20-26, enter account_id, project_id, Full Stack user_id, environmentKey, and updateDatafile | |
Step 2: make sure your Full Stack project has the events you want to mirror created. | |
The API names need to match between the Web and Full Stack events. | |
Example: on Web, i have a click event "Homepage clicks" with API name "123456790_homepage_clicks" | |
In the Full Stack project, a custom event with the same name "123456790_homepage_clicks" needs to be created for this script to work | |
Step 3: add the script to Project Javascript | |
Step 4: load your page and check the network tab for events going to /events with "client_name": "Optimizely/fswebintegration" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*output is a concatenated string for testing, but feel free to reformat as needed*/ | |
/*campaignID:experimentId:variationId:audienceId:"audience conditions"*/ | |
/*e.g. 7807482864:7807902575:7806347946:6536242902:"and,or,or,{"value":"iphone","type":"device","name":null,"match":null}",7807482864:7807902575:7806347946:9436482444:"and,or,or,{"value":"00:00_23:59_friday","type":"time_and_day","name":null,"match":null}"*/ | |
/*this code only includes audiences for which the visitor actually qualified*/ | |
var state = window.optimizely.get && window.optimizely.get('state'); | |
var data = window.optimizely.get && window.optimizely.get('data'); | |
(function getCurrentActiveAll(e) { | |
if ('undefined' !== typeof window.optimizely) { |