- git clone https://github.com/mlibrary/readership-map
- cd readership-map
- composer install
- have .htaccess set GOOGLE_APPLICATION_CREDENTIALS to the path of the readership map's .json file.
setenv GOOGLE_APPLICATION_CREDENTIALS /path/to/readership-map.json
- View the map at index.html
- See the data at data.php
Because data.php takes some time to run:
git clone https://github.com/mlibrary/readership-mapcd readership-mapcomposer installGOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials/file php data.php > pins.jsonphp readership-map.js.php > readership-map.js- Copy
index.html*.jsand*.jsonto the place where the maps are served. - Have cron run
GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials/file php data.php > pins.tmp && mv pins.tmp pins.js
Investigate enhanced ecommerce for Google Analytics.
gtag('event', 'view_item', {
"items": [
{
"id": "P12345",
"name": "Android Warhol T-Shirt",
"list_name": "Search Results",
"brand": "Google",
"category": "Apparel/T-Shirts",
"variant": "Black",
"list_position": 1,
"quantity": 2,
"price": '2.0'
}
]
});In this case, I imagine we could encode the following:
id: url
name: title
brand: author
variant: open | subscriptioncategory and list_name might be available for future use. list_position are probably not going to be relevant.
Quantity and price seem irrelevant, and unlikely to be useful.
An alternative to using the enhanced ecommerce gtag.js would be using the Google Analytics Measurment protocol.
Possible concerns: limits on the lengths of these fields
500 bytes is the limit on most of the fields.