Index.html platform specific Google Maps API Key


I am using the javascript google maps api, using this tag in my index.html"

<script src=""></script>

And now I want to use platform specific API keys in the index.html file.

I found someone injecting a script tag using javascript in the index.html file, using:

if (ionic.Platform.isAndroid()) {

But this does not work anymore.

Maybe I can use ionic/app-scripts and the copy-command, but that would probably mean I have to maintain 3 separate index.html files.

Is there any other way I can solve this?