Skip to content

Commit 899cd59

Browse files
authored
Fix apollo build error (#267)
1 parent b83b359 commit 899cd59

4 files changed

Lines changed: 21 additions & 16 deletions

File tree

docs/play.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Svix Play - webhook debugger
2+
title: Svix Play - Webhooks Debugger
33
---
44

55
You can use the [Svix Play webhook playground and debugger](https://www.svix.com/play/) to easily inspect, test and debug operational webhooks.
@@ -175,4 +175,3 @@ curl -X DELETE https://api.play.svix.com/api/v1/history/e_94XdF-OwN3EaTKty4izJDW
175175
```
176176

177177
This will permanently remove all events associated with that token.
178-

docusaurus.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ module.exports = {
137137
async: true,
138138
defer: true,
139139
},
140+
{
141+
src: "/js/apollo.js",
142+
async: true,
143+
defer: true,
144+
},
140145
{
141146
src: "/js/commonroom.js",
142147
async: true,

src/client-modules/apollo-pixel.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
const APOLLO_APP_ID = '66317583955bbd0438bc78c3';
22

3-
function loadApolloScript() {
4-
const nocache = Math.random().toString(36).substring(7);
5-
const script = document.createElement('script');
6-
script.src = `https://assets.apollo.io/micro/website-tracker/tracker.iife.js?nocache=${nocache}`;
7-
script.async = true;
8-
script.defer = true;
9-
script.onload = function () {
3+
function trackApolloPage() {
4+
if (window.trackingFunctions) {
105
window.trackingFunctions.onLoad({ appId: APOLLO_APP_ID });
11-
};
12-
document.head.appendChild(script);
6+
}
137
}
148

15-
loadApolloScript();
16-
179
export function onRouteDidUpdate({ location, previousLocation }) {
1810
if (location.pathname !== previousLocation?.pathname) {
19-
if (window.trackingFunctions) {
20-
window.trackingFunctions.onLoad({ appId: APOLLO_APP_ID });
21-
}
11+
trackApolloPage();
2212
}
2313
}

static/js/apollo.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(function () {
2+
var APOLLO_APP_ID = '66317583955bbd0438bc78c3';
3+
4+
var script = document.createElement('script');
5+
script.id = 'apollo-tracker-script';
6+
script.src = 'https://assets.apollo.io/micro/website-tracker/tracker.iife.js';
7+
script.async = true;
8+
script.defer = true;
9+
10+
document.head.appendChild(script);
11+
})();

0 commit comments

Comments
 (0)