Skip to content

Commit

Permalink
Serve the visitor-side analytics script using the common predicate. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rla committed Dec 15, 2018
1 parent 1a6195c commit 66f4b22
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions prolog/bc/bc_api_analytics.pl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
:- use_module(bc_data_entry).
:- use_module(bc_analytics).
:- use_module(bc_analytics_db).
:- use_module(bc_admin_file).

% Handlers for data from the readers script.

Expand Down Expand Up @@ -49,20 +50,12 @@
:- route_get(bc/'readers.min.js', visitor_script).

visitor_script:-
http_current_request(Request),
module_property(bc_api_analytics, file(File)),
file_directory_name(File, Dir),
atom_concat(Dir, '/public/js/readers.min.js', Path),
http_reply_file(Path, [unsafe(true)], Request).
bc_admin_send_file('js/readers.min.js').

:- route_get(bc/'readers.min.js.map', visitor_script_map).

visitor_script_map:-
http_current_request(Request),
module_property(bc_api_analytics, file(File)),
file_directory_name(File, Dir),
atom_concat(Dir, '/public/js/readers.min.js.map', Path),
http_reply_file(Path, [unsafe(true)], Request).
bc_admin_send_file('js/readers.min.js.map').

:- register_schema(bc_analytics_user, _{
type: dict,
Expand Down

0 comments on commit 66f4b22

Please sign in to comment.