postal icon indicating copy to clipboard operation
postal copied to clipboard

Tracking customers using Analytics

Open navinp opened this issue 8 years ago • 6 comments

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.

navinp avatar Apr 03 '18 05:04 navinp

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.

willpower232 avatar Apr 03 '18 08:04 willpower232

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.

navinp avatar Apr 03 '18 13:04 navinp

Have you tried saving the javascript as a separate file and including it with src instead of inline?

willpower232 avatar Apr 03 '18 13:04 willpower232

I haven't tried that, as I am not familiar with how the haml language works, will need to find out first

navinp avatar Apr 03 '18 13:04 navinp

As @willpower232 says, you can insert this into the templates but it will be removed on updates.

adamcooke avatar Apr 04 '18 18:04 adamcooke

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"}/

navinp avatar Aug 29 '18 14:08 navinp