ankane / ahoy_email

First-party email analytics for Rails
MIT License
1.12k stars 137 forks source link

Understanding of Ahoy::Click and relation with Ahoy #166

Closed Splitrox closed 4 hours ago

Splitrox commented 5 hours ago

Hi,

Can't seem to understand what is the relation from Ahoy::Click and the rest of Ahoy Classes and how i can use to get valuable feedback. For example, Ahoy works with events, for example $view. Can't see nothing related to events. To create my own event i had to do:

class CustomSubscriber < AhoyEmail::DatabaseSubscriber
  def track_send(data)
    super
  end

  def track_click(data)
    super

    ahoy = data[:controller].ahoy

    ahoy.track "$email_click", url: data[:url]
  end

  def stats(campaign)
    super
  end
end

And this still contains issues, for example is not relating the view and user id to the actual person so I can't really know where is this coming from and how this click ends at (purchase/form signup). Also it doesnt allow me to pass all of this data related from a specific campaign to a specific event.

Also what is the purpose of Ahoy::Click#token and does it server to relate to any other data? Ahoy::Click class seems empty

Another thing is that it seems i can only know the campaign and not the step related with the click. For example lets imagine I have a campaign for reminding a user about something. I would like to know how many clicks i had on the first step, second and third separately.

ankane commented 4 hours ago

Hi @Splitrox, click analytics are separate from Ahoy visits/events (and not tied to a specific message/user unless AhoyEmail.save_token is set). You can use UTM tagging to track which visits came from a specific email campaign (and Ahoy events / visitable to associate purchases/sign ups with visits).

Please use other resources for additional help with this.

Splitrox commented 1 hour ago

Hello @ankane thank you for your response, indeed AhoyEmail.save_token is great, if i only enable now, does that mean my old data will not be tied? (and only new ones?).

Also do you know how i can pass the step name (if possible) to one of UTM tags? That way i could easily track almost everything i need.

About Ahoy visitable, going to take a look and didn't know about, appreciate.

About further help where do you recommend? Do you have any place that anyone might be able to take questions about ahoy_email? I know some of my questions are not 100% related to ahoy email but as I'm using them together I decided to ask.