I was wondering what is the best practices for placing tracking pixels in Spree. Currently, we are placing raw JavaScript code into application.html.rb. I think it is best to store it in the javascripts folder in the assets folder and use javascript_include_tag to include it in the Application.html.erb. However, doing it this way will result in multiple requests. Should I render a partial instead?
We usually render stuff like this using partials with the js in them.
I like to think about my views the same way I do my other code: you wouldn’t just jam all your code in one method, you’d extract things. I think of extracting partials very similarly.