and one more question, Graham mentioned that for ...
# ask-questions
a
and one more question, Graham mentioned that for inline experiments, I can dynamically set the url attribute and target the experiment (I am using react) However, after setting the attribute, I can't find any info how to check for the url/path. do I have to manually parse the gb object context, and execute the experiment if the url = /somepath ? Or is there a built-in function I can use to check the paths?
f
GrowthBook has several ways to match rules, for URLs, you can use regex for path matching
a
can you point me to the docs where I can find about inline matching rules?
I see this for UI Editor: https://docs.growthbook.io/app/visual#url-targeting but I am running an inline experiment from the React
This is my hook example:
Copy code
useEffect(() => {

      // Load all experiments and variants
      gb.loadFeatures({ autoRefresh: true, timeout: 2000 })

      // Set user attributes for targeting (from cookie, auth system, etc.)
      gb.setAttributes({
        id: client_id, 
        url: window.location.href
      });

      if (expConfig.running) {

        //load configured experiment
        const exp = gb.run(expConfig);

        if (exp.value === expConfig.variations[0]) { //always a control
          dispatch(bootOptimize( {enableExperiment: false }));
          console.log(`exp variant - ${expConfig.variations[0]}`);
        }
        if (exp.value === expConfig.variations[1]) {
          dispatch(bootOptimize( {enableExperiment: true }));
          console.log(`exp variant - ${expConfig.variations[1]}`);
        }

      }

  }, [])
but I can't find anything on how to properly apply the rule matching in the code
f
a
oh wow I totally missed that, thanks!!