Comments (11)
you can use a dynamic GA code like this:
config.middleware.use Rack::Tracker do
handler :google_analytics, {
tracker: lambda { |env| env['site_ga'] },
}
and set the code in your controller like this
before_action do
env[:site_ga] = "XXX"
end
from rack-tracker.
is that decent enough? :)
from rack-tracker.
pretty similar to this: #10
we should document this scenario ;)
from rack-tracker.
oh yea thx @DonSchado for giving a link ;) we should definitely document that!
from rack-tracker.
Aha clear. I think than it's still not possible to pass multiple GA id's to the tracker?
Like described in:
config.middleware.use(Rack::Tracker) do
handler :go_squared, {
trackers: {
primaryTracker: 'ABCDEFGH',
secondaryTracker: '1234567',
}
}
end
I don't see a construct like:
https://github.com/railslove/rack-tracker/blob/master/lib/rack/tracker/go_squared/template/go_squared.erb#L10
in:
https://github.com/railslove/rack-tracker/blob/master/lib/rack/tracker/google_analytics/template/google_analytics.erb
from rack-tracker.
hm, you want to have more than one tracker on a page?
from rack-tracker.
Yeah for example: https://app.bookingexperts.nl/nl/front/search/22:Go-Parcs?currency=EUR
Maybe server side calls like (gabba: https://github.com/hybridgroup/gabba) would better fit our use case.
Or should we extend https://github.com/railslove/rack-tracker/blob/master/lib/rack/tracker/google_analytics/template/google_analytics.erb to handle multiple trackers?
from rack-tracker.
yea. i see what you mean, so this is your use case then?
form what i see every tracker will then get the same events and tracks, correct? i assume this is a valid case then :) it will get hard if we want to send different events to different trackers.
are you interested in making a PR proposal?
from rack-tracker.
Yeah correct.
I'm interested but I first want to figure out the right tool for this issue.
Grabba might be something (looking into it now). If it's not what we want I think I will move to this.
Will let you know.
from rack-tracker.
cool 💃
its some years ago i was using gabba, so i cannot reason about it :)
from rack-tracker.
@kangguru just used a hybrid approach. Gabba for events / transactions. Client-side library for pageviews (to reduce external calls from our server)
Think it fits our use case better:
- Multi trackers
- Just ruby code, no javascript
- Handle event / transaction tracking in the controller which in my opinion is a better place than the views
- Easier to test
Downside of course:
- Rack-tracker is way more automatic.
I think rack-tracker will be a good fit for other projects of us so I will definitely use it at some point and hopefully make a contribution.
from rack-tracker.
Related Issues (20)
- No such handler: Facebook pixel (ArgumentError) HOT 3
- How to use outside of controller? HOT 5
- Google Analytics using the beacon transport HOT 1
- Syntax when using rack-tracker for both Google Analytics and Google Ads HOT 4
- Bing tracking HOT 1
- Sending rack-tracker events from "backend" code HOT 3
- Render templates directly for JS responses HOT 3
- Google Tag Manager with turbolinks: true duplicates pageView when using Push HOT 6
- No events being injected into the page HOT 1
- Google Global integration: purchase transaction_id HOT 7
- content security policy HOT 10
- how to set user_id? HOT 1
- Avoid injection for AMP pages HOT 9
- How can I use the tracker in a model or service? HOT 3
- Remote form and AJAX request redirects never run events HOT 2
- syntax error, unexpected ':', expecting keyword_end (SyntaxError) HOT 6
- Can not get FacebookPixel to work HOT 1
- Add Support for Reddit Ads Pixel HOT 3
- Update is coming ? Google Analytics 4 GA4 Killed my groove HOT 11
- Can't Override Default google_tag_manager Event
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rack-tracker.