Skip to content

Commit 2f817f5

Browse files
committed
update docs
1 parent 7a04ad4 commit 2f817f5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

docs/index.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Basic metrics tracking for your `Flask`_ application. The core of library is ver
1414
The following is optional:
1515

1616
* `freegeoip.net <http://freegeoip.net/>`_ integration for storing geography of the visitor.
17+
* Alternatively you can define a custom geolocation function, for use with the geoip2 package for example.
1718
* Unique visitor tracking if you are wanting to use Flask's cookie storage.
1819
* Summation hooks for live count of common web analysis statistics such as hit counts.
1920

@@ -55,6 +56,8 @@ Usage
5556
app.config['TRACK_USAGE_USE_FREEGEOIP'] = False
5657
# You can use a different instance of freegeoip like so
5758
# app.config['TRACK_USAGE_FREEGEOIP_ENDPOINT'] = 'https://example.org/api/'
59+
# (You can also define a custom geolocation function when initializing the extension)
60+
5861
app.config['TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS'] = 'include'
5962

6063
# We will just print out the data for the example
@@ -68,7 +71,9 @@ Usage
6871
t = TrackUsage(app, [
6972
PrintWriter(),
7073
OutputWriter(transform=lambda s: "OUTPUT: " + str(s))
71-
])
74+
],
75+
custom_geolocation_function # (Optional)
76+
)
7277

7378
# Include the view in the metrics
7479
@t.include
@@ -156,7 +161,8 @@ TRACK_USAGE_USE_FREEGEOIP
156161

157162
**Default**: False
158163

159-
Turn FreeGeoIP integration on or off. If set to true, then geography information is also stored in the usage logs.
164+
Turn FreeGeoIP integration on or off. If set to true, then the geography information is also stored in the usage logs.
165+
Alternatively you can define a custom geolocation lookup function when initializing the extension.
160166

161167
.. versionchanged:: 1.1.
162168
The default server for using geoip integration changed to extreme-ip-lookup.com

0 commit comments

Comments
 (0)