@playpilot/tpi 6.10.6 → 6.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@ export async function fetchLinkInjections(
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// This is used when debugging (using window.PlayPilotLinkInjections.debug())
|
|
53
|
-
window.PlayPilotLinkInjections.
|
|
53
|
+
window.PlayPilotLinkInjections.successful_fetches?.push(response)
|
|
54
54
|
|
|
55
55
|
return response
|
|
56
56
|
}
|
|
@@ -20,8 +20,8 @@ export type ScriptConfig = {
|
|
|
20
20
|
after_article_insert_position?: InsertPosition | ''
|
|
21
21
|
// The language of the page will be inferred from the html `lang` attribute. Can be set manually using this option in the config object.
|
|
22
22
|
language?: string | null
|
|
23
|
-
//
|
|
24
|
-
|
|
23
|
+
// Lists all fetches to external pages
|
|
24
|
+
successful_fetches?: LinkInjectionResponse[]
|
|
25
25
|
// Lists all tracked events through the `track()` function.
|
|
26
26
|
tracked_events?: { event: string, payload: Record<string, any> }[]
|
|
27
27
|
// Queued tracking events that were fired before consent was given. These might be fired later if the user consents.
|
package/src/main.ts
CHANGED
|
@@ -15,7 +15,7 @@ window.PlayPilotLinkInjections = {
|
|
|
15
15
|
region: null,
|
|
16
16
|
organization_sid: null,
|
|
17
17
|
domain_sid: null,
|
|
18
|
-
|
|
18
|
+
successful_fetches: [],
|
|
19
19
|
tracked_events: [],
|
|
20
20
|
queued_tracking_events: [],
|
|
21
21
|
split_test_identifiers: {},
|
|
@@ -94,8 +94,8 @@ window.PlayPilotLinkInjections = {
|
|
|
94
94
|
console.log('Valid elements', elements)
|
|
95
95
|
console.groupEnd()
|
|
96
96
|
|
|
97
|
-
console.groupCollapsed('
|
|
98
|
-
console.log(this.
|
|
97
|
+
console.groupCollapsed('Successful fetches')
|
|
98
|
+
console.log(this.successful_fetches)
|
|
99
99
|
console.groupEnd()
|
|
100
100
|
|
|
101
101
|
console.groupCollapsed('Meta')
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { SplitTest } from '$lib/enums/SplitTest'
|
|
3
|
+
import { getPageMetaData } from '$lib/meta'
|
|
3
4
|
import { getFullUrlPath } from '$lib/url'
|
|
4
5
|
import { onDestroy } from 'svelte'
|
|
5
6
|
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
const secrets = ['tpidebug', 'debugtpi']
|
|
13
14
|
const lastInputs: string[] = []
|
|
14
15
|
const isUsingBetaScript = !!document.querySelector('script[src*="scripts.playpilot.com/link-injection@next"]')
|
|
16
|
+
const metadata = getPageMetaData()
|
|
15
17
|
|
|
16
18
|
let data = $state(dataToReadable())
|
|
17
19
|
let shown = $state(false)
|
|
@@ -24,7 +26,7 @@
|
|
|
24
26
|
function dataToReadable(): Record<string, undefined | Record<string, any>[]> {
|
|
25
27
|
const data = window.PlayPilotLinkInjections
|
|
26
28
|
|
|
27
|
-
const
|
|
29
|
+
const successfulInjections = data.evaluated_link_injections?.filter(injection => !injection.failed) || []
|
|
28
30
|
const failedInjections = data.evaluated_link_injections?.filter(injection => injection.failed) || []
|
|
29
31
|
|
|
30
32
|
const visiblePixels = Array.from(document.querySelectorAll<HTMLImageElement>('[data-playpilot-pixel]'))
|
|
@@ -36,7 +38,8 @@
|
|
|
36
38
|
{ label: 'HTML selector', data: data.selector },
|
|
37
39
|
],
|
|
38
40
|
'API Config': Object.entries(window.PlayPilotLinkInjections.config || {}).map(([label, data]) => ({ label, data })),
|
|
39
|
-
|
|
41
|
+
'External pages responses': window.PlayPilotLinkInjections.successful_fetches?.map((item, index) => ({ label: index + 1, data: item })),
|
|
42
|
+
[`Successful injections (${successfulInjections.length})`]: successfulInjections.map(injection => ({ label: injection.title, data: injection.sentence })),
|
|
40
43
|
[`Failed injections (${failedInjections.length})`]: failedInjections.map(injection => ({ label: injection.title, data: `Reason: ${injection.failed_message} | Sentence: ${injection.sentence}` })),
|
|
41
44
|
[`Fetched ads (${data.ads?.length || 0})`]: data.ads?.map(ad => ({ label: ad.campaign_name, data: ad })),
|
|
42
45
|
[`Tracking events (${data.tracked_events?.length || 0})`]: data.tracked_events?.map(event => ({ label: event.event, data: event.payload })),
|
|
@@ -121,6 +124,14 @@
|
|
|
121
124
|
|
|
122
125
|
<hr />
|
|
123
126
|
|
|
127
|
+
<div class="meta">
|
|
128
|
+
{metadata.content_heading}<br>
|
|
129
|
+
modified_time: {metadata.content_modified_time}<br>
|
|
130
|
+
published_time: {metadata.content_published_time}
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<hr />
|
|
134
|
+
|
|
124
135
|
{#if !!(window.PlayPilotLinkInjections.config?.exclude_urls_pattern && getFullUrlPath().match(window.PlayPilotLinkInjections?.config?.exclude_urls_pattern))}
|
|
125
136
|
<span class="error">The current URL is excluded via the config</span>
|
|
126
137
|
<hr />
|
|
@@ -177,6 +188,7 @@
|
|
|
177
188
|
}
|
|
178
189
|
|
|
179
190
|
hr {
|
|
191
|
+
margin: margin(0.5) 0;
|
|
180
192
|
border-color: theme(primary);
|
|
181
193
|
}
|
|
182
194
|
|
|
@@ -206,11 +218,16 @@
|
|
|
206
218
|
border: 1px solid theme(primary);
|
|
207
219
|
background: black;
|
|
208
220
|
overflow: auto;
|
|
209
|
-
color: white;
|
|
210
221
|
font-family: "Consolas", monospace;
|
|
222
|
+
font-size: theme(font-size-base);
|
|
223
|
+
line-height: 1.5em;
|
|
211
224
|
color: theme(primary);
|
|
212
225
|
}
|
|
213
226
|
|
|
227
|
+
.meta {
|
|
228
|
+
font-size: theme(font-size-small);
|
|
229
|
+
}
|
|
230
|
+
|
|
214
231
|
.item {
|
|
215
232
|
white-space: nowrap;
|
|
216
233
|
overflow-x: auto;
|