pendulum-chain / vortex

1 stars 0 forks source link

Add twitter code to the Vortex success screen #145

Closed prayagd closed 1 week ago

prayagd commented 2 weeks ago

Context

In order to track the success of the twitter ads that marketing would be running, this ticket is to add a code snippet on the Vortex success screen

Requirements

<script type="text/javascript">
  // Insert Twitter Event ID
  twq('event', 'tw-o93io-onjq9', {
  });
</script>
prayagd commented 2 weeks ago

Hey team! Please add your planning poker estimate with Zenhub @b-yap @bogdanS98 @ebma @gianfra-t @TorstenStueber

ebma commented 2 weeks ago

How would this track the success of Twitter ads? Wouldn't we need to somehow check whether a user was redirected to the prototype from Twitter and only then trigger that event?

gianfra-t commented 2 weeks ago

I agree. Do we want this for Google Analytics? We can setup a custom URL, trigger a "from twitter event", then redirect to landing.

prayagd commented 2 weeks ago

image

@ebma this code and this image was provided to me by marketing team, while the text above in the image says twitter pixel must be installed to the web page before adding the code, i think that would help in tracking. Let me also get a better understanding of this and come back

ebma commented 2 weeks ago

I read an article about it and now I think we really don't need anything besides the pixel. I'm not 100% sure but the way I understand it, Twitter would be able to track users due to the metadata gained from the user's device which is sent to Twitter's server when downloading this pixel embedded in our page. I assume they then map this to some metadata they already have and can then decide if the user is coming from a Twitter ad or if they are 'unknown'.

TorstenStueber commented 2 weeks ago

@prayagd I don't think that this is the whole code of the "pixel". The function twq does not exist, this code would just fail. There would need to be an additional script tag to include some JavaScript code and we could then call that function manually instead of adding the script tag from the screenshot.

Another alternative is that we need to set this up in Google Tag Manager: https://www.analyticsmania.com/post/twitter-tracking-pixel-google-tag-manager/

Then our GTM script would possibly be able to provide the function twq.

TorstenStueber commented 2 weeks ago

Besides: I don't think that it matters whether we call twq only in the case a user comes from X/Twitter. We can just call the function every time there is a success and the tracking system will figure it out.

gianfra-t commented 2 weeks ago

I think this is what to be installed (copy first)

image

This is step 4 of installing the pixel your site. Then we can add events, but maybe this will be overlapped with google analytics. Unless we want to track "how many people coming from twitter connect the wallet, offramp, ...etc"

prayagd commented 2 weeks ago

Another alternative is that we need to set this up in Google Tag Manager: https://www.analyticsmania.com/post/twitter-tracking-pixel-google-tag-manager/

Adding a google tag manager would increase the lead time here as it is external developer dependent.

This is step 4 of installing the pixel your site. Then we can add events, but maybe this will be overlapped with google analytics. Unless we want to track "how many people coming from twitter connect the wallet, offramp, ...etc"

No we dont have to track everything only if the user coming from twitter was able to succesfully offramp that's it, looks like your suggestion of the pixel code would work, @TorstenStueber would the suggestion from @gianfra-t work?

gianfra-t commented 1 week ago

@TorstenStueber I will try this, hopefully there is a test environment I can play around in X. But in the meantime @pendulum-chain/product can marketing share that code from the account that will be used to track the campaign?

TorstenStueber commented 1 week ago

Yes, go ahead. That code looks correct to me.

But why not just do the option "Install with Tag Manager" (second tab on the screenshot)? GTM is already included and I can set it up in GTM (as I did the other events). That way we can reduce the JS code pollution in our frontend.

gianfra-t commented 1 week ago

Yes that can also work, perhaps we want to track all that is X on the X dashboard and not mix? I don't know if the tag manager solution will record the info on the campaign dashboard on X, on in Google analytics.

In any case, for both solutions we need access to the marketing account to get the information (id, code). I couldn't find any test environment for X ads.

TorstenStueber commented 1 week ago

I will reach out for details.

TorstenStueber commented 1 week ago

I completed this task by just connecting the transaction_success we send to GTM in case the flow is successful to an event in twitter. I tested it and it works. This task is completed now.

gianfra-t commented 1 week ago

Glad that it worked! But can you explain how was it connected? Did you add some extra code on the prototype? How does GTM realize that the user is coming from the twitter add?

TorstenStueber commented 1 week ago

GTM collects the necessary data on behalf of any other tools it is connected to. I connected it to Twitter, so it knows what needs to be done.