Search code examples
javascriptruby-on-railsevent-tracking

Rails Fire Tracking Pixel Server Side?


Is it possible to fire a tracking pixel in a controller? Here's what the pixel would look like added on the page:

<img src="http://tracking.go2cloud.org/SL1VE" width="1" height="1" />

This works great from the client side when added in the HTML.

What I'm attempting to do now though is to call the user using Twilio from the browser, and then upon getting the completion call event (which comes back as a POST call to my controller from Twilio), to then fire the above tracking pixel. I'm wondering if there's a way to fire the above pixel in my controller when that POST comes in from Twilio? Can I just make a GET request to that URL?

Thanks in advance!


Solution

  • Yes. All you need to do you is make a get request to that URL:

    Net::HTTP.get(URI('http://tracking.go2cloud.org/SL1VE'))