Class: Spree::Integrations::YahooAds
- Inherits:
-
Spree::Integration
- Object
- Spree::Integration
- Spree::Integrations::YahooAds
- Defined in:
- app/models/spree/integrations/yahoo_ads.rb
Overview
Yahoo!広告のコンバージョン計測(JSタグ方式)を Store 単位で有効化する Integration。
- サイトジェネラルタグ(head) … yclid をファーストパーティ Cookie(_ycl_yjad)に捕捉
- コンバージョン測定タグ(完了時) … 検索広告(YSS) / ディスプレイ広告(YDA)
検索広告(YSS)とディスプレイ広告(YDA)はタグの type / パラメータ名が異なる。 それぞれ独立して設定でき、両方設定した場合は完了時に2種類のコンバージョンを発火する。
- YSS: yss_conversion / yahoo_conversion_id / yahoo_conversion_label
- YDA: ydn_conversion / yahoo_ydn_conv_io / yahoo_ydn_conv_label
Class Method Summary collapse
Instance Method Summary collapse
-
#conversion_tags(value: nil) ⇒ Object
設定済みの広告種別ごとに、コンバージョン測定タグ(ytag)の { type:, config: } を返す。 YSS のみ→1件、YDA のみ→1件、両方→2件、未設定→空配列。value には注文金額を渡す。.
- #yda_configured? ⇒ Boolean
- #yss_configured? ⇒ Boolean
Class Method Details
.icon_path ⇒ Object
35 36 37 |
# File 'app/models/spree/integrations/yahoo_ads.rb', line 35 def self.icon_path 'integration_icons/yahoo-ads-logo.png' end |
.integration_group ⇒ Object
31 32 33 |
# File 'app/models/spree/integrations/yahoo_ads.rb', line 31 def self.integration_group 'analytics' end |
.integration_name ⇒ Object
27 28 29 |
# File 'app/models/spree/integrations/yahoo_ads.rb', line 27 def self.integration_name Spree.t('admin.integrations.yahoo_ads.name', default: 'Yahoo Ads') end |
Instance Method Details
#conversion_tags(value: nil) ⇒ Object
設定済みの広告種別ごとに、コンバージョン測定タグ(ytag)の { type:, config: } を返す。 YSS のみ→1件、YDA のみ→1件、両方→2件、未設定→空配列。value には注文金額を渡す。
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/models/spree/integrations/yahoo_ads.rb', line 49 def (value: nil) = [] if yss_configured? << { type: 'yss_conversion', config: { 'yahoo_conversion_id' => preferred_yss_conversion_id, 'yahoo_conversion_label' => preferred_yss_conversion_label, 'yahoo_conversion_value' => value.to_s } } end if yda_configured? << { type: 'ydn_conversion', config: { 'yahoo_ydn_conv_io' => preferred_yda_conversion_id, 'yahoo_ydn_conv_label' => preferred_yda_conversion_label, 'yahoo_ydn_conv_value' => value.to_s } } end end |
#yda_configured? ⇒ Boolean
43 44 45 |
# File 'app/models/spree/integrations/yahoo_ads.rb', line 43 def yda_configured? preferred_yda_conversion_id.present? && preferred_yda_conversion_label.present? end |
#yss_configured? ⇒ Boolean
39 40 41 |
# File 'app/models/spree/integrations/yahoo_ads.rb', line 39 def yss_configured? preferred_yss_conversion_id.present? && preferred_yss_conversion_label.present? end |