Tracking customers using Analytics
Hello,
I want to add analytics to Postal, so I can see what is happening on my platform, but I don't know which file to edit.
I want to know what my customers are doing/when they are doing it etc, some data. I can easily see this using analytics. But how to implement this/or in which file should I add the js code.
You'll need to edit one or more of the HAML files to include your analytics javascript.
You might want to start here but there may be others to edit as well: https://github.com/atech/postal/blob/master/app/views/layouts/application.html.haml
Please note that any changes to the files will almost definitely be removed during an update.
Hello,
I tried this today, first I converted the javascript into haml format and after that just copy pasted it exactly as is, both times the application got broken.
Also I need to add my analytics in the footer, but for testing purposes I tried the application.html.haml file.
Have you tried saving the javascript as a separate file and including it with src instead of inline?
I haven't tried that, as I am not familiar with how the haml language works, will need to find out first
As @willpower232 says, you can insert this into the templates but it will be removed on updates.
For those that are interested solving this:
Go to: /opt/postal/app/app/views/layouts
Open the file application.html.haml
Insert after <!--- Postal Version #{Postal.version} --> your tracking code.
If you are using Clicky, just enter the code like this
%img{:alt => "Clicky", :height => "1", :src => "//in.getclicky.com/ID.gif", :width => "1"}/