Optimize
2.8K members online now
2.8K members online now
Learn how to create your first experiment and get tips on creating A/B, redirect, and multivariate tests.
Guide Me
star_border
Reply

ga('require', 'GTM-XXXXXXY'); versus ga('require', 'displayfeatures');

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi!


I used to run experiments in GA, but now "Analytics Content Experiments remain available but are being deprecated in the future. Learn more about Optimize". So I did.

The first thing I see is that I need to add this string:

ga('require', 'GTM-XXXXXXY');       right before    ga('send', 'pageview');   in my existing GA code.

But there is the 'displayfeatures' plugin there:

ga('create', 'UA-XXXXX-Y', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');

What should I do? Just add GTM-  after 'displayfeatures', like this?  

 

ga('require', 'displayfeatures', 'GTM-XXXXXXY');

Any help is appreciated. You'll get +100 to your karma for answering :-)

P.S. I don't use Google Tag Manager

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Sasha Y
June

Re: ga('require', 'GTM-XXXXXXY'); versus ga('require', 'displayfeatures');

Explorer ✭ ✭ ☆
# 2
Explorer ✭ ✭ ☆

I guess you are referencing "Optimize and Google Tag Manager".

You can not add multiple plugins in a single "require" directives as documented here. But you can have multiple require lines.

 

Here's what you can do in your GTM tag:

ga('create','UA-XXXX-Y','auto');
ga('require','displayFeature');
ga('require','GTM-XXXXXXY');
// do not add the ga('send','pageview') if you are firing your pageview via a native GTM Pageview tag

Hope that helps.

 

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Sasha Y
June

Re: ga('require', 'GTM-XXXXXXY'); versus ga('require', 'displayfeatures');

Explorer ✭ ✭ ☆
# 2
Explorer ✭ ✭ ☆

I guess you are referencing "Optimize and Google Tag Manager".

You can not add multiple plugins in a single "require" directives as documented here. But you can have multiple require lines.

 

Here's what you can do in your GTM tag:

ga('create','UA-XXXX-Y','auto');
ga('require','displayFeature');
ga('require','GTM-XXXXXXY');
// do not add the ga('send','pageview') if you are firing your pageview via a native GTM Pageview tag

Hope that helps.

 

ga('require', 'GTM-XXXXXXY'); versus ga('require', 'displayfeatures');

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you, Stéphane H! This time I'm going to stick to GA Experiments (while it still works). But later I'll try Optimize and will use two require directives.

Thanks again,

Sasha.