0

I'm trying to use the Segment Analytics .NET library in an application. Is there a way to configure it so that it doesn't actually send data to the cloud? Like a "NoOp" when it comes to the actual sending of data?

The documentation states the following (for development purposes):

You can use this initialization during development while testing the library. SetAsync(false) will make sure the library makes a request to our servers every time it’s called.

Analytics.Initialize("YOUR_WRITE_KEY", new Config().SetAsync(false)); Don’t forget to set async back to true for production, so that you can advantage of asynchronous flushing on a different thread.

To me, this reads as: "On localhost development, you will STILL SEND THE DATA to the cloud -but- instead of trying to be efficient and batching it up, etc... we'll send it ASAP after each call."

Which sucks because I would like the option to NOT send any data anywhere, but my code 'thinks' it's getting sent, still.

Is there a special configuration trick?

1 Answer 1

0

There's a (not documented?) property called Send .. which will either send the data upstream or not (a nop using a FakeRequestHandler).

e.g.

Analytics.Initialize("YOUR_WRITE_KEY", new Config{ Send = false });

Here's the code in their library that does all this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.