Напишите вначале ответа "GA", чтобы отсеять ботов.
Я использую Content Experiment код отсюда:
Использую его в GTM как custom html.
Проблема в том, что у меня в 10 раз меньше экспериментальных сессий, чем обычных.
Я так понимаю, что дело может быть в том, что код с вариациями должен отрабатывать строго до кода GA.
С связи с этим нужна консультация:
1. Каким инструментом проверить порядок срабатывания кода Content Experiments и кода GA.
В GA debugger и GTM preview не могу это увидеть.
GTM preview
GA debugger
2. Как достичь нужной последовательности?
В GTM уже настроено так, что код CE идет перед GA.
Triggering rules for Content Experiment script:
В справке гугла написано
"If you can't guarantee the library load order or that a hit will be sent after the chooseVariation method is called, then you can send another hit to Google Analytics (for example a non-interaction event) to make sure the values are sent."
Имеет ли смысл добавить код события в код Content Experiments?
Например так:
<!-- Load the JQuery library -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script>
// Define JavaScript for each page variation of this experiment.
var pageVariations = [
function() {}, // Original: Do nothing. This will render the default HTML.
function() { // Variation 1: Banner Image
document.getElementById('banner').src = 'bay-bridge.jpg';
},
function() { // Variation 2: Sub-heading Text
document.getElementById('heading').innerHTML = 'Look, a Bridge!';
},
function() { // Variation 3: Button Text
document.getElementById('button').innerHTML = 'Learn more';
},
function() { // Variation 4: Button Color
document.getElementById('button').className = 'button button-blue';
}
];
// Wait for the DOM to load, then execute the view for the chosen variation.
$(document).ready(function(){
// Execute the chosen view
pageVariations[chosenVariation]
});
function () {
ga('send', {
hitType: 'event',
eventCategory: 'test',
eventAction: 'pageview',
eventValue: 1,
nonInteraction: true,
});
}
</script>