Skip to content

Instantly share code, notes, and snippets.

View durw4rd's full-sized avatar

Michal Fasanek durw4rd

View GitHub Profile
@durw4rd
durw4rd / ld-contentsquare-integration-guide.md
Last active June 11, 2025 12:40
Integration Guide: Send LaunchDarkly experiment evaluation details to Contentsquare

Integration Guide: Send LaunchDarkly experiment evaluation details to Contentsquare


NOTE

This is not an officially supported integration. Feel free to use the code as is or make modifications to it according to your needs but note that if you need help with any potential modifications to the integration, this would need to be through a paid engagement with LaunchDarkly's Professional Services team. The (free) Technical Support team won't be able to help you.

Contact your Account Executive or Customer Success Manager if you’d like to learn more about our PS offerings.


@durw4rd
durw4rd / admin-portal-bet-mgm
Created April 16, 2024 14:41
Custom Role Definitions for Entain
[
{
"resources": [
"application/*"
],
"actions": [
"*"
],
"effect": "allow"
},
@durw4rd
durw4rd / ld-mobile-analytics-integration.md
Last active August 26, 2024 12:59
Integrating LaunchDarkly Mobile SDKs with Third-Party Analytics

Integrating LaunchDarkly Mobile SDKs with Third-Party Analytics

Overview

This guide provides instructions for setting up LaunchDarkly Mobile SDKs on Android and iOS to send feature flag evaluation details to third-party analytics platforms. By creating a wrapper around the SDK's variation method, developers can capture flag evaluation data and send it to analytics tools, enabling deeper insights into feature flag usage and its impact on the user experience.

Requirements

  • LaunchDarkly Mobile SDK for Android/iOS
  • Access to a third-party analytics platform (e.g., Mixpanel, Google Analytics)
@durw4rd
durw4rd / event-transformer.js
Created November 23, 2023 13:48
Sample code for converting the payload received via LD webhook inside PagerDuty's EventTransformer service
function formatMember(member) {
if (!member) {
return ''
}
if (!member.firstName && !member.lastName) {
return member.email
}
return [member.firstName, member.lastName].join(' ')
}
@durw4rd
durw4rd / ld-ga-integration-example.js
Created February 1, 2023 10:01
Code sample showing an example of how the Inspectors interface can be used to trigger GA events. This example is assuming the presence of GTM datalayer.
var flagEvalHandler = (flagKey, flagDetail) => {
let {
reason,
variationIndex,
value
} = flagDetail;
if (!reason.inExperiment) {
console.log("Not in experiment, only send live events to GA")
return;
@durw4rd
durw4rd / fetch-envs.js
Created September 20, 2022 19:17
Fetch a list of LD Environment keys for a given project
import fetch from 'node-fetch';
import dotenv from 'dotenv';
dotenv.config();
async function run() {
const projectKey = 'ADD YOUT PROJECT KEY';
const resp = await fetch(
`https://app.launchdarkly.com/api/v2/projects/${projectKey}/environments`,
{
@durw4rd
durw4rd / update-flag-across-envs.js
Last active September 20, 2022 19:27
A script to batch-update feature flag across many LD environments
import fetch from 'node-fetch';
import dotenv from 'dotenv';
dotenv.config();
// Add a list of environments where the flag should be updated
const envKeys = [];
async function run() {
// Add Project and Flag keys
@durw4rd
durw4rd / overrideReferrer.js
Created December 15, 2021 16:20
Override document referrer when performing redirect experiments
function overrideReferrer() {
let referrerOverwritten = false;
let originalReferrer = optimizely.get('state').getRedirectInfo() && optimizely.get('state').getRedirectInfo().referrer;
if (!referrerOverwritten && originalReferrer) {
Object.defineProperty(document, "referrer", {get : function(){ return referrer; }});
referrerOverwritten = true;
}
};
/*
@durw4rd
durw4rd / push-pop-state-page-deactivation.js
Created December 9, 2021 14:01
Deactivating Optimizely page(s) based on browser history API triggers
(function (_pushState) {
var pushState = history.pushState;
history.pushState = function (state) {
if (typeof history.onpushstate == "function") {
history.onpushstate({
state: state
});
}