- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
03-26-2018 09:09 AM
I have 3 amplitude projects:
Prod, QA, Dev
How do I specify which project to use by environment?
Example: When I'm in Dev mode, I want the tag to use the dev project on Amplitude that has a different API_KEY than the QA and Prod?
The reason behind this is that I don't want to have rubbish events on my prod project.
Thanks for the answers.
03-26-2018 09:18 AM
Hi @Sshuichci
The first thing is to make your API key dynamic, by creating a UDO variable to hold it, and then mapping that into the tag configuration (ideally using a pre-defined mapping that comes as standard with the tag, but I'm not familiar with Amplitude).
Then set that UDO variable based on the environment currently detected. You could use a lookup table or a Set Data Variables extension, but I'll just give the example in pure JS:
if(b["ut.env"] === "prod") b.Amplitude_API_key = "your_production_api_key"; if(b["ut.env"] === "qa") b.Amplitude_API_key = "your_testing_api_key"; if(b["ut.env"] === "dev") b.Amplitude_API_key = "your_development_api_key";
And in theory that should sort you out.. Give me a shout if you need any further detail.
03-26-2018 12:34 PM
@Sshuichci you can also use a lookup table that looks at the URL, or Utag Environment (ut.env) variable, or any other variable that provides a clear distinction. For more info, check out this article: Lookup Tables
Copyright All Rights Reserved © 2008-2023