lib/ahoy_email/processor.rb in ahoy_email-0.2.1 vs lib/ahoy_email/processor.rb in ahoy_email-0.2.2
- old
+ new
@@ -21,11 +21,11 @@
ahoy_message.mailer = options[:mailer] if ahoy_message.respond_to?(:mailer=)
ahoy_message.subject = message.subject if ahoy_message.respond_to?(:subject=)
ahoy_message.content = message.to_s if ahoy_message.respond_to?(:content=)
ahoy_message.save
- message["Ahoy-Message-Id"] = ahoy_message.id
+ message["Ahoy-Message-Id"] = ahoy_message.id.to_s
end
rescue => e
report_error(e)
end
@@ -88,10 +88,10 @@
def track_links
if html_part?
body = (message.html_part || message).body
doc = Nokogiri::HTML(body.raw_source)
- doc.css("a").each do |link|
+ doc.css("a[href]").each do |link|
# utm params first
if options[:utm_params] and !skip_attribute?(link, "utm-params")
uri = Addressable::URI.parse(link["href"])
params = uri.query_values || {}
%w[utm_source utm_medium utm_term utm_content utm_campaign].each do |key|