How can I turn dataLayer.push into a Google Analyt

2019-09-19 04:06发布

I like to turn

window.dataLayer.push({ 'event': 'Offer', 'vpv': '/offer-lead'});

or

window.dataLayer.push({ 'event': 'Offer', 'eventCategory': 'Success', 'eventAction': 'Lead', 'eventLabel': pageId});

into a GA Goal that shows people who I count as "leads".

I managed to catch this event in TM but not in GA.
Can you please take me to the needed steps in both TM and GA?

2条回答
我只想做你的唯一
2楼-- · 2019-09-19 04:25

You need two things.

1) Tie together dataLayer with Google Analytics in TagManager. So you have to create new Tag for Google Analytics type EVENT. You set up Property ID and event parameters such as Category, Action and Label. All of them set up as macro/variable type DataLayer and point them to your key names in dataLayer push (eventCategory, eventAction and eventLabel). Firing rule should be more generic than event equals Offer, rather user event equals fire or something more generic. You can re-use the Tag for all other events.

2) Set up Google Analytics. There create new goal from event and set Category to Success and Action to Lead.

This is it.

查看更多
霸刀☆藐视天下
3楼-- · 2019-09-19 04:39

window.dataLayer.push({ 'event': 'Offer', 'vpv': '/offer-lead'});

Here's the solution I eventually came up with:

    1. I created a Trigger of a Custom Event set to Fire On "Offer".
    2. I created a Data Layer Variable called "vpv".
    3. I created a GA Tag of "Page View" with "More Settings=>Fields to Set" of "page" set to the Data Layer Variable from step 2.
      I set it to Fire On the trigger from step 1.
  1. In GA, I created a Destination Goal for the path of "/offer-lead".
查看更多
登录 后发表回答