question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unsure of how to use

See original GitHub issue

Good day!

I am unsure as to how to actually use the module with Google Optimize.

We have a SSR-ed Nuxt application, with Google Tag Manager installed and properly set up. We recieve statistics and added the Google Optimize bingings to the GTM on the GTM’s side and it is working properly - segmentation occurs, cookie is set and all that.

Then, we’ve brought in your module, to actually react to the experiments on the server side. And this is where I get confused: your module sets the cookie with name exp and format { experimentID }.{ variant index }. GTM sets the cookie with name _gaexp and format GAX1.2.2{ experimentID }.?????.{ variant index }. Variant index actually differs between two cookies from time to time, and I don’t really know which one actually applies.

This is separate (I think) from #16, as the $exp object is available.

Thank you for your assistance!

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:16

github_iconTop GitHub Comments

5reactions
brandonaaskovcommented, Nov 15, 2019

I’ve gotten this working on our project, and it’s not that clear so I thought I’d share here. I’ll open a PR soon to update the README.

First, here’s the code sandbox: https://codesandbox.io/s/nuxt-google-optimize-example-43w4y

You’ll either get three pictures of Keanu, or three pictures of Swayze depending on which bucket Google Optimize decides you fall into. You can test this by opening a variety of private browser windows. You can refresh over and over (within Code Sandbox’s limits) and see that your list never changes: you’ve been properly bucketed.

The setup is in the nuxt.config.js file. The experiment file just has to match on the experiment ID. The nuxt config sets up Google Optimize alongside Google Analytics. What happens behind the scenes is that Google Optimize will bucket you (represented as this.$exp.variantIndexes) into one of the variants you created for your experiment. What this module does is automatically populate $activeVariants with that variant’s data provided by your experiment file. This is demo’d in that code sandbox. You can edit the .env file if you want to try with your own setup.

Major thing to note: tracking doesn’t show up in Google Analytics until about 24 hours later so you could easily be misled into thinking it’s not working when it probably is.

Setting up the google optimize side of things is a little unclear too, so here’s a pic of that: image

5reactions
brandonaaskovcommented, Oct 25, 2019

I’m going to jump in here as well: it’s really not clear how this is supposed to be used. I also have GTM and GA properly set up (as far as I know), and I can retrieve the $exp object in my code. That said, nothing is getting reported back to Google Optimize and it’s not clear why that’s the case.

Could you publish a tiny sample app on how to use this on Codesandbox or something similar? That would go a long way toward understanding how to work with this module.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use unsure in a sentence
Unsure whether to move away from him or verbally fend him off, she did neither. 445. 92.
Read more >
unsure in a sentence - Cambridge Dictionary
Examples of unsure · I looked past him unsure if he could see me. · Is it merely that we archaeologists are unsure...
Read more >
Examples of 'unsure' in a sentence - Collins Dictionary
When you feel unsure, take three deep breaths and think the problem through calmly. The Sun. (2008). We raise our eyebrows, shake our...
Read more >
"unsure of" or "unsure about"--which is right? - Absolute Write
Hey everyone, I'm second, fourth and twenty-guessing myself on this one. Which sentence is correct? Unsure about his next grade, ...
Read more >
Use unsure of in a sentence - Examples - Bab.la
See how to use unsure of in a sentence. Lot of example sentences with the word unsure of.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found