share tracking
This commit is contained in:
@@ -210,6 +210,7 @@ const shareUrl = ref(null)
|
|||||||
|
|
||||||
function shareOrder() {
|
function shareOrder() {
|
||||||
sharing.value = true
|
sharing.value = true
|
||||||
|
track('share')
|
||||||
getShareUrl().then(url => {
|
getShareUrl().then(url => {
|
||||||
shareUrl.value = url
|
shareUrl.value = url
|
||||||
sharing.value = false
|
sharing.value = false
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {useChartOrderStore} from "@/orderbuild.js";
|
|||||||
import {changeIntervalSecs, onChartReady, setSymbol, widget} from "@/charts/chart.js";
|
import {changeIntervalSecs, onChartReady, setSymbol, widget} from "@/charts/chart.js";
|
||||||
import {usePrefStore, useStore} from "@/store/store.js";
|
import {usePrefStore, useStore} from "@/store/store.js";
|
||||||
import {lookupSymbol} from "@/charts/datafeed.js";
|
import {lookupSymbol} from "@/charts/datafeed.js";
|
||||||
|
import {track} from "@/track.js";
|
||||||
|
|
||||||
export async function getShareUrl() {
|
export async function getShareUrl() {
|
||||||
const co = useChartOrderStore();
|
const co = useChartOrderStore();
|
||||||
@@ -26,7 +27,9 @@ export async function getShareUrl() {
|
|||||||
const json = JSON.stringify(data)
|
const json = JSON.stringify(data)
|
||||||
console.log('sharing data', json, data)
|
console.log('sharing data', json, data)
|
||||||
const compressed = compressToEncodedURIComponent(json);
|
const compressed = compressToEncodedURIComponent(json);
|
||||||
const baseUrl = `${window.location.protocol}//${window.location.hostname}:${window.location.port}`;
|
let baseUrl = `${window.location.protocol}//${window.location.hostname}`;
|
||||||
|
if (window.location.port)
|
||||||
|
baseUrl += ':' + window.location.port
|
||||||
const imageFile = await takeSnapshot()
|
const imageFile = await takeSnapshot()
|
||||||
return `${baseUrl}/shared?i=${imageFile}&d=${compressed}`;
|
return `${baseUrl}/shared?i=${imageFile}&d=${compressed}`;
|
||||||
}
|
}
|
||||||
@@ -59,6 +62,7 @@ export function loadShareUrl() {
|
|||||||
setSymbol(symbol)
|
setSymbol(symbol)
|
||||||
.catch((e)=>console.error('could not set symbol', e))
|
.catch((e)=>console.error('could not set symbol', e))
|
||||||
})
|
})
|
||||||
|
track('shared')
|
||||||
console.log('loaded orders', s.chainId, co.orders)
|
console.log('loaded orders', s.chainId, co.orders)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user