mirror of
https://github.com/mashirozx/sakura.git
synced 2024-11-22 23:08:14 +08:00
feat: Google Analytics adaptation
This commit is contained in:
parent
211bea9ab6
commit
67dffdbfa4
@ -215,6 +215,7 @@ function sakura_scripts()
|
|||||||
'reply_link_version' => $reply_link_version,
|
'reply_link_version' => $reply_link_version,
|
||||||
'api' => esc_url_raw(rest_url()),
|
'api' => esc_url_raw(rest_url()),
|
||||||
'nonce' => wp_create_nonce('wp_rest'),
|
'nonce' => wp_create_nonce('wp_rest'),
|
||||||
|
'google_analytics_id' => akina_option('google_analytics_id', '')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
add_action('wp_enqueue_scripts', 'sakura_scripts');
|
add_action('wp_enqueue_scripts', 'sakura_scripts');
|
||||||
|
@ -1751,6 +1751,11 @@ var home = location.href,
|
|||||||
$('#loading-comments').after(result.fadeIn(500));
|
$('#loading-comments').after(result.fadeIn(500));
|
||||||
$('ul.commentwrap').after(nextlink);
|
$('ul.commentwrap').after(nextlink);
|
||||||
lazyload();
|
lazyload();
|
||||||
|
if (window.gtag) {
|
||||||
|
gtag('config', Poi.google_analytics_id, {
|
||||||
|
'page_path': path
|
||||||
|
});
|
||||||
|
}
|
||||||
code_highlight_style();
|
code_highlight_style();
|
||||||
click_to_view_image();
|
click_to_view_image();
|
||||||
}
|
}
|
||||||
@ -1838,6 +1843,12 @@ $(function () {
|
|||||||
$.getScript("//static.duoshuo.com/embed.js");
|
$.getScript("//static.duoshuo.com/embed.js");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}).on('pjax:end', function() {
|
||||||
|
if (window.gtag){
|
||||||
|
gtag('config', Poi.google_analytics_id, {
|
||||||
|
'page_path': window.location.pathname
|
||||||
|
});
|
||||||
|
}
|
||||||
}).on('submit', '.search-form,.s-search', function (event) {
|
}).on('submit', '.search-form,.s-search', function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$.pjax.submit(event, '#page', {
|
$.pjax.submit(event, '#page', {
|
||||||
|
Loading…
Reference in New Issue
Block a user