G
G
godsplane2020-05-15 11:50:44
JavaScript
godsplane, 2020-05-15 11:50:44

Is it possible to pass a variable to the metric target like this?

I make counters by utm tags
I get the label of the current page like this

let utmObject = Object.fromEntries(window.location.search.slice(1).split('&').filter(item => item.indexOf('utm') !== -1).map(item => item.split('=')));

Yandex goal looks like this
ym(52810492,'reachGoal',utmObject.utm_source.toString())

It is right? I checked several times and still do not understand whether it works or not, according to the idea, the target identifier should be in quotes, but I just insert

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mahmudchon, 2020-05-15
@mahmudchon

You can check if the goal worked.
Add a get variable to the address bar, like this:
example.com/?_ym_debug=1
And after the target fires, you will see the response in the browser console.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question