How can I turn dataLayer.push into a Google Analytics Goal?

家住魔仙堡 提交于 2019-12-11 20:36:08

问题


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?


回答1:


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.




回答2:


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".


来源:https://stackoverflow.com/questions/30099665/how-can-i-turn-datalayer-push-into-a-google-analytics-goal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!