Skip to content

Commit

Permalink
Merge pull request #4 from abtion/parameterize-pirsch-key
Browse files Browse the repository at this point in the history
Make Pirsch analytics integration optional
  • Loading branch information
runephilosof-abtion authored Aug 21, 2024
2 parents 86122f7 + 43b313f commit c9e55c7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ services:
- web

widget:
build: ./widget
build:
context: ./widget
args:
- PIRSCH_KEY
ports:
- "3031:80"
depends_on:
Expand Down
2 changes: 2 additions & 0 deletions widget/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ RUN npm install
# Copying all the files in our project
COPY . .

ARG PIRSCH_KEY

# Building our application
RUN npm run build

Expand Down
12 changes: 10 additions & 2 deletions widget/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1369,8 +1369,16 @@ <h2 id="offline-message-heading">
}

</script>
<script defer type="text/javascript" src="https://api.pirsch.io/pirsch.js" id="pirschjs"
data-code="VEW6587Xat8LXjE7ejokwXUked6s7udc"></script>
<script type="module">
const pirsch_key = process.env.PIRSCH_KEY
if (pirsch_key) {
let script = document.createElement("script");
script.setAttribute("src", "https://api.pirsch.io/pirsch.js");
script.setAttribute("id", "pirschjs");
script.setAttribute("defer", "");
script.setAttribute("data-code", pirsch_key);
}
</script>
</body>

</html>

0 comments on commit c9e55c7

Please sign in to comment.