Closed genlighten closed 4 years ago
did you see the source for google global? https://github.com/railslove/rack-tracker/tree/master/lib/rack/tracker/google_global support for events is missing though in google global, PRs are welcome ;)
I don't know the google trackers well, but ideally you use google global.
for event tracking with google global you can help review this PR: https://github.com/railslove/rack-tracker/pull/126 does that work for you?
I'm afraid I'm very much a beginner with Rails, js and Google Ads. I'm not quite at the point where I feel confident attempting to review the pull request you reference or making my own PR. But thanks for being so encouraging!
ok, no worries. maybe you can test if that branch works for you? as it contains the events feature that you were asking for.
I'm trying to implement google ads conversion tracking using the gtag.js approach Google now advocates and rack-tracker now supports.
This is the syntax I've added in my production.rb file. Is this correct?
config.middleware.use(Rack::Tracker) do handler :google_analytics, { tracker: 'UA-12345678-1', ecommerce: true } handler :google_global, { trackers: [ { id: 'AW-123456789' } ] } end
Or should I just use a single google_global handler as the example in the rack-tracker documentation suggests, with two trackers, one with the google analytics ID and the other with the google ads ID?
Next I want to trigger a Google Ads conversion event when my leads submit the form on my landing page and are taken to a thank you page. The Google Ads docs seem to refer to this as an "event snippet" and they give an example that looks like this:
gtag('event', 'sign_up', { 'account_type': 'basic' // Optional data describing the type of account created by the user. });
How do I use rack-tracker to generate this type of event snippet from my controller?
Thanks very much,
Dean