++ Open Web Analytics

https://test.freeplanet.app/owa
This commit is contained in:
Paolo Arena
2019-03-16 23:47:13 +01:00
parent 9fabd68bae
commit f23f60e540
17 changed files with 154 additions and 41 deletions

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.0.54"
APP_VERSION="0.0.55"
APP_NAME="FreePlanet"
SERVICE_WORKER_FILE="service-worker.js"
APP_ID="1"

View File

@@ -54,20 +54,15 @@ const extendHTMLToWebpack = (config) => {
module.exports = function (ctx) {
return {
// Quasar looks for *.js files by default
sourceFiles: {
router: 'src/router/index.ts',
store: 'src/store/index.ts'
htmlVariables: {
appName: 'FreePlanet',
appDescription: 'The first Real Social, Free, Fair and Equitable'
},
// Quasar looks for *.js files by default
sourceFiles: {
router: 'src/router/index.ts',
store: 'src/store/index.ts'
},
sourceFiles: {
router: 'src/router/index.ts',
store: 'src/store/index.ts'
},
// app plugins (/src/plugins)
boot: ['vue-i18n', 'axios', 'vee-validate', 'myconfig', 'local-storage', 'error-handler', 'globalroutines', 'vue-idb', 'dragula', 'guard'],
css: [
@@ -103,7 +98,7 @@ module.exports = function (ctx) {
.alias
.set('~', __dirname)
.set('@', helpers.root('src'))
// .set('env', helpers.root('config/helpers/env.js'))
// .set('env', helpers.root('config/helpers/env.js'))
config.module
.rule('template-engine')
.test(/\.pug$/)
@@ -215,7 +210,7 @@ module.exports = function (ctx) {
// swSrc: 'src/sw.js',
},
manifest: {
name: 'Free Planet',
name: 'FreePlanet',
version: '0.0.14',
short_name: 'freeplanet',
description: 'Social project in order to connecting people each others (working in progress...)',

View File

@@ -289,6 +289,10 @@ if (workbox) {
workbox.strategies.networkOnly()
);
workbox.routing.registerRoute(
new RegExp('/owa/'),
workbox.strategies.networkOnly()
);
}

View File

@@ -1,9 +1,6 @@
// import something here
// leave the export, even if you don't use it
export default ({ app, router, store, Vue }) => {
// something to do
// ******************************************
// *** Per non permettere di accedere alle pagine in cui è necessario essere Loggati ! ***
// ******************************************
@@ -15,7 +12,7 @@ export default ({ app, router, store, Vue }) => {
const subsequentMiddleware = middleware[index]
// If no subsequent Middleware exists,
// the default `next()` callback is returned.
if (!subsequentMiddleware) return context.next
if (!subsequentMiddleware) { return context.next }
return (...parameters) => {
// Run the default Vue Router `next()` callback first.
@@ -24,7 +21,7 @@ export default ({ app, router, store, Vue }) => {
// `nextMiddleware()` callback.
const nextMiddleware = nextFactory(context, middleware, index + 1)
subsequentMiddleware({ ...context, next: nextMiddleware })
};
}
}
router.beforeEach((to, from, next) => {

View File

@@ -3,7 +3,7 @@ import myconfig from '../myconfig'
// leave the export, even if you don't use it
export default ({ Vue }) => {
//Vue.use(myconfig);
// Vue.use(myconfig);
// something to do
Vue.prototype.$myconfig = myconfig
}

View File

@@ -0,0 +1,8 @@
// import something here
import track from '../track'
// leave the export, even if you don't use it
export default ({ app, router, store, Vue }) => {
// something to do
Vue.prototype.$track = track
}

View File

@@ -5,16 +5,3 @@ export default ({ Vue }) => {
Vue.use(VueIdb)
}
/*
export default new VueIdb({
version: 1,
database: 'test',
schemas: [
{ categories: '++_id, sub_categ_id, descr_it' }
]
})
*/

View File

@@ -1,12 +1,12 @@
import indexdb from './indexdb'
import { GlobalStore } from "../store/Modules";
import { GlobalStore } from '../store/Modules'
export default async (context, cmd, table, data = null, id = '') => {
const descr = data !== null ? data.descr : ''
// console.log('globalroutines', cmd, table, descr, id)
return await indexdb(context, cmd, table, data, id)
.then(ris => {
setTimeout(function () {
setTimeout(() => {
GlobalStore.state.connData.uploading_indexeddb = 0
GlobalStore.state.connData.downloading_indexeddb = 0
}, 1000)
@@ -14,7 +14,7 @@ export default async (context, cmd, table, data = null, id = '') => {
}
).catch(err => {
setTimeout(function () {
setTimeout(() => {
GlobalStore.state.connData.uploading_indexeddb = (GlobalStore.state.connData.uploading_indexeddb === 1) ? -1 : GlobalStore.state.connData.uploading_indexeddb
GlobalStore.state.connData.downloading_indexeddb = (GlobalStore.state.connData.downloading_indexeddb === 1) ? -1 : GlobalStore.state.connData.downloading_indexeddb
}, 1000)

View File

@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title><%= htmlWebpackPlugin.options.productName %></title>
<title><%= htmlWebpackPlugin.options.appName %></title>
<meta charset="utf-8">
<meta name="description" content="<%= htmlWebpackPlugin.options.productDescription %>">
<meta name="description" content="<%= htmlWebpackPlugin.options.appDescription %>">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport"
@@ -14,12 +14,13 @@
<link rel="icon" type="image/png" sizes="32x32" href="<%= htmlWebpackPlugin.files.publicPath %>statics/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="<%= htmlWebpackPlugin.files.publicPath %>statics/icons/favicon-16x16.png">
<link rel="stylesheet" type="text/css" href="<%= htmlWebpackPlugin.files.publicPath %>statics/css/dragula.css">
<script defer src="<%= htmlWebpackPlugin.files.publicPath %>statics/js/material.min.js"></script>
<!--<script defer src="<%= htmlWebpackPlugin.files.publicPath %>statics/js/material.min.js"></script>-->
<!--<script src="<%= htmlWebpackPlugin.files.publicPath %>statics/js/promise.js"></script>-->
<!--<script src="<%= htmlWebpackPlugin.files.publicPath %>statics/js/fetch.js"></script>-->
<!--<script src="<%= htmlWebpackPlugin.files.publicPath %>statics/js/idb.js"></script>-->
<!--<script src="<%= htmlWebpackPlugin.files.publicPath %>statics/js/storage.js"></script>-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="<%= htmlWebpackPlugin.files.publicPath %>statics/js/track.js"></script>
</head>
<body>

View File

@@ -303,7 +303,17 @@ body.mobile .landing:before {
padding: 10px;
}
.carousel_img_3 {
//background-image: url(../../statics/images/cibo_sano.jpg);
background-size: cover !important;
background-position: 50% center !important;
background-repeat: no-repeat !important;
}
@media (max-width: 718px) {
// PER VERSIONE MOBILE
.landing__hero {
text-align: center
}
@@ -360,6 +370,14 @@ body.mobile .landing:before {
.text-subtitle3 {
font-size: 0.75rem;
}
.carousel_img_3 {
//background-image: url(../../statics/images/cibo_sano.jpg);
background-size: 620px 620px !important;
background-position: 50% top !important;
background-repeat: no-repeat !important;
}
}
.custom-caption {
@@ -368,3 +386,4 @@ body.mobile .landing:before {
color: white;
background-color: rgba(0, 0, 0, .3);
}

View File

@@ -35,6 +35,7 @@ export default class Home extends Vue {
public $q
public polling
public slide = 'first'
public animare: number = 0
constructor() {
super()
@@ -64,6 +65,7 @@ export default class Home extends Vue {
clearInterval(this.polling)
}
public created() {
this.animare = process.env.DEV ? 0 : 8000
GlobalStore.actions.prova()
}

View File

@@ -5,7 +5,7 @@
<div class="landing__hero">
<q-carousel
animated
:autoplay="8000"
:autoplay="animare"
swipeable
infinite
navigation
@@ -193,7 +193,7 @@
<!--<div class="text-subtitle1">Famous City</div>-->
<!--</div>-->
</q-carousel-slide>
<q-carousel-slide name="third" img-src="../../statics/images/cibo_sano.jpg">
<q-carousel-slide name="third" img-src="../../statics/images/cibo_sano.jpg" class="carousel_img_3">
<div class="landing__header"></div>
<div class="landing__hero-content row justify-center q-gutter-xs clgutter">
<div class="row">

View File

@@ -481,7 +481,7 @@ const messages = {
underconstruction: 'App in construction...',
myDescriz: '',
sottoTitoloApp: 'The first Real Social',
sottoTitoloApp2: 'Free, Fair and solidarity',
sottoTitoloApp2: 'Free, Fair and Equitable',
sottoTitoloApp3: 'Where the conscience and community help live',
sottoTitoloApp4: 'Free and without advertising',
},

43
src/statics/js/track.js Normal file
View File

@@ -0,0 +1,43 @@
function geturl() {
const miaurl = document.location.href
if (miaurl.includes('test.')) {
return 'https://test.freeplanet.app/'
} else {
if (miaurl.includes('localhost')) {
return 'http://localhost:8080/'
} else {
return 'https://freeplanet.app/'
}
}
}
function getidtrack() {
const miaurl = document.location.href
if (miaurl.includes('test.') || miaurl.includes('localhost')) {
return '4c40a07bc88a9c50c9b70dc9c5cd8e2e'
} else {
return '9853abef079fc8330ab188a9cbf07a0c'
}
}
var owa_baseUrl = geturl() + 'owa/';
if (owa_cmds)
var owa_cmds = [];
else
var owa_cmds = owa_cmds || [];
owa_cmds.push(['setSiteId', getidtrack()]);
owa_cmds.push(['trackPageView']);
owa_cmds.push(['trackClicks']);
(function () {
var _owa = document.createElement('script');
_owa.type = 'text/javascript';
_owa.async = true;
owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl);
_owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';
var _owa_s = document.getElementsByTagName('script')[0];
_owa_s.parentNode.insertBefore(_owa, _owa_s);
}());

50
src/track/index.ts Normal file
View File

@@ -0,0 +1,50 @@
// Start Open Web Analytics Tracker
export default ({ app, router, store, Vue }) => {
console.log('Track 1')
function geturl() {
const miaurl = document.location.href
if (miaurl.includes('test.')) {
return 'https://test.freeplanet.app/'
} else {
if (miaurl.includes('localhost')) {
return 'http://localhost:8080/'
} else {
return 'https://freeplanet.app/'
}
}
}
let owa_cmds
if (owa_cmds) {
owa_cmds = owa_cmds || []
}
else {
owa_cmds = []
}
let idsite = ''
if (process.env.PROD) {
idsite = '9853abef079fc8330ab188a9cbf07a0c'
} else {
// TEST
idsite = '4c40a07bc88a9c50c9b70dc9c5cd8e2e'
}
owa_cmds.push(['setSiteId', idsite])
owa_cmds.push(['trackPageView'])
owa_cmds.push(['trackClicks'])
const owa_baseUrl = geturl() + 'owa/'
console.log('******* setTrack', 'owa_baseUrl:', owa_baseUrl)
const _owa = document.createElement('script')
_owa.type = 'text/javascript'
_owa.async = true
// owa_baseUrl = ('https:' === document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl)
_owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js'
const _owa_s = document.getElementsByTagName('script')[0]
_owa_s.parentNode.insertBefore(_owa, _owa_s)
}

View File

@@ -5,4 +5,3 @@ declare module 'vue/types/vue' {
$errorHandler: errorHandler
}
}

8
src/typings/libs/track.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
import { track } from '../../track'
declare module 'vue/types/vue' {
interface Vue {
$track: track
}
}