steep-city-78416
03/03/2023, 12:53 PMsteep-city-78416
03/03/2023, 2:02 PMgb.loadFeatures({ autoRefresh: true })
: how long it takes to auto-refresh.
⢠There's the GrowthBook proxy application. When it's recomended to use? ( Is there a request number recommendation?)
⢠The Proxy docs says real-time feature rollouts. Without proxy it's not real-time?enough-fall-27040
03/03/2023, 2:09 PMbreezy-megabyte-18851
03/05/2023, 1:03 PMvictorious-library-28522
03/06/2023, 7:57 AMtrackingcallback
function is not being called. I am sending an event to GA and also using console.log in the trackingcallback
. Is there something I can do ensure it runs smoothly ?lemon-stone-42630
03/06/2023, 12:50 PMautoRefresh
on features as those could be refreshed until the instance is shut down rather than fetching them seperately for every invocation. Any ideas or suggestions to make it perfect with this type of server implementation?famous-carpenter-71953
03/07/2023, 3:04 AMGrowthBookProvider
component but how can I do so with a React on Rails app? Iām trying to connect the frontend to the SDKwooden-country-60054
03/07/2023, 4:35 AMshy-shoe-92329
03/07/2023, 9:47 AMflaky-area-48500
03/07/2023, 11:24 PMcrooked-grass-27007
03/08/2023, 12:47 PMbusy-air-96466
03/08/2023, 4:02 PM<head>
<!-- Google dataLayer variables -->
<script>
window.dataLayer = window.dataLayer || [];
</script>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'<https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f)>;
})(window,document,'script','dataLayer','GTM-xxxxxxxx');</script>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="<https://www.googletagmanager.com/ns.html?id=GTM-xxxxxxx>"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Based on the GB tutorial Iāve put this in index.js:
window.growthbook = new GrowthBook({
apiHost: "<http://localhost:4100>",
clientKey: "sdk-xxxxxx",
enableDevMode: true,
trackingCallback: (experiment, result) => {
// TODO: Use your real analytics tracking system
console.log("Viewed Experiment", {
experimentId: experiment.key,
variationId: result.key
});
// track using GA4
if ("gtag" in window) {
window.gtag("event", "experiment_viewed", {
event_category: "experiment",
experiment_id: experiment.key,
variation_id: result.variationId,
});
} else {
console.log("no gtag");
}
}
});
GrowthBook is working in the app; I created a feature in GrowthBook and can test for it in the app and display different UI š but the above always logs āno gtagā, and also it only runs once, on page load. Has anyone used GrowthBook with Google Tag Manager?breezy-night-6725
03/09/2023, 8:24 AMfew-oxygen-55281
03/09/2023, 10:55 AMclever-traffic-8328
03/09/2023, 5:12 PMwooden-country-60054
03/09/2023, 11:51 PMclever-pharmacist-41490
03/10/2023, 8:49 PMfreezing-apple-73992
03/13/2023, 1:57 PMdelightful-city-54850
03/13/2023, 2:53 PMfreezing-apple-73992
03/14/2023, 4:56 AMprehistoric-beach-86927
03/14/2023, 1:12 PMtsc
:
node_modules/@growthbook/growthbook/dist/GrowthBook.d.ts:23:84 - error TS2304: Cannot find name 'SubtleCrypto'.
23 setEncryptedFeatures(encryptedString: string, decryptionKey?: string, subtle?: SubtleCrypto): Promise<void>;
~~~~~~~~~~~~
Found 1 error in node_modules/@growthbook/growthbook/dist/GrowthBook.d.ts:23
I have created a class to abstract growthbook for the rest of my application like this:
import { GrowthBook, setPolyfills } from '@growthbook/growthbook';
setPolyfills({
// Required when using built-in feature loading and Node 17 or lower
fetch: require("cross-fetch"),
// Required when using encrypted feature flags and Node 18 or lower
SubtleCrypto: require("node:crypto").webcrypto.subtle,
// Optional, can make feature rollouts faster
EventSource: require("eventsource"),
})
class XPlat {
provider: GrowthBook;
constructor() {
this.provider = new GrowthBook({
apiHost: "<https://cdn.growthbook.io>",
clientKey: "my-key",
enableDevMode: true,
});
}
isOn(name: string): boolean {
return this.provider.isOn(name);
}
}
export const xplat = new XPlat();
I am using NodeJS
v16.15.1 . I have also tried compiling it with NodeJs v18
and upgrading @types/node
to the latest version, but I keep getting the same error. Any idea how to fix this?strong-receptionist-72327
03/14/2023, 6:29 PMstrong-receptionist-72327
03/14/2023, 7:36 PMprehistoric-beach-86927
03/15/2023, 9:22 AMfew-electrician-23747
03/15/2023, 10:02 AMfunc main() {
growthbook.SetLogger(&growthbook.DevLogger{})
featureMap := GetFeatureMap()
features := growthbook.ParseFeatureMap(featureMap)
context := growthbook.NewContext().
WithFeatures(features).WithTrackingCallback(func(experiment *growthbook.Experiment, result *growthbook.ExperimentResult) {
log.Println("Viewed Experiment")
log.Println("Experiment Id", experiment.Key)
log.Println("Variation Id", result.VariationID)
})
gb := growthbook.New(context)
gb.WithAttributes(growthbook.Attributes{
"user_id": "123",
"loggedIn": true,
"experiment_id": "123",
})
if gb.Feature("test-feature").On {
// Feature is enabled!
fmt.Println("TEST FEATURE 1 IS ON AND WORKING")
} else {
fmt.Println("TEST FEATURE 1 IS OFF AND NOT WORKING")
}
}
few-electrician-23747
03/16/2023, 2:01 AMkind-salesmen-90944
03/16/2023, 7:14 AMfew-electrician-23747
03/16/2023, 12:25 PM[INFO] Skip rule because user not in experiment: test-feature &{{map[loggedIn:true]} 0x140000aa1e0 <nil> [true false] 0x1400009a190 [0.5 0.5] <nil> 0x1400009a1a0}
How to ensure that user is in the experiment?cuddly-journalist-11507
03/16/2023, 3:16 PMbusy-air-96466
03/17/2023, 3:14 PMSELECT
user_id,
user_pseudo_id as anonymous_id,
TIMESTAMP_MICROS(event_timestamp) as timestamp
FROM
``analytics_xxxxxx.events_*``
WHERE
event_name = 'Main CTA'
AND _TABLE_SUFFIX BETWEEN '{{startYear}}{{startMonth}}{{startDay}}' AND '{{endYear}}{{endMonth}}{{endDay}}'
My experiment based on this metric is running without error but showing no data.
I must be missing something really simpleā¦itās so close to working! But I canāt think of anything else to check.