Solved

Generate SDK

  • 16 February 2022
  • 3 replies
  • 320 views

Badge

We have a gatsby website that I am trying to track events. We have defined a tracking plan using Iteratively. 

So I believe the steps are next to generate the sdk using that tracking plan. I have followed the steps in the documentation - https://developers.data.amplitude.com/browser. This generates a src/itly/index.js file which has methods for my track events. It also export itlySdk.

However I am unable to get this file properly included and working in our gatsby website. I have tried making a plugin but cannot get it to work.

My first question is the 2 different types of Browser - Javascript sources. I cannot find these mentioned anywhere in the docs. So should I be using Browser - Javascript or Browser - Javascript (Itly).

Secondly the file generate when using Browser - Javascript (Itly) exports itlySdk. Whereas the documentation steps talk about importing itly. https://developers.data.amplitude.com/browser#import-into-your-app. I don’t have itly defined in the generated javascript.

Thirdly the docs say “Since JavaScript is not a type-safe language, the library won't expose type-safe functions for the events in your team’s tracking plan.” But in the generated Javascript I see defined methods for my track events. For example 

websitePageView(properties, options) {
this.itly.track(new WebsitePageView(properties), options);
}

Can anyone please help me out on these doubts. Any insights would be greatly appreciated.

icon

Best answer by eddie.gaona 17 February 2022, 18:00

View original

3 replies

Userlevel 5
Badge +9

Hello @ballanty, happy to help!

So should I be using Browser - Javascript or Browser - Javascript (Itly).

Answer: This decision is ultimately up to the customer. The documentation on installing Browser - Javascript (Itly) can be found, here. You can also, find the implementation of the Browser - Javascript on the Implementation page in your Iteratively account.

 

Secondly the file generate when using Browser - Javascript (Itly) exports itlySdk. Whereas the documentation steps talk about importing itly. https://developers.data.amplitude.com/browser#import-into-your-app. I don’t have itly defined in the generated javascript.

Answer: I am not entirely sure what the ask is here. The import refers to importing the generated SDK into your project to leverage the methods that come with the generated SDK.

 

Thirdly the docs say “Since JavaScript is not a type-safe language, the library won't expose type-safe functions for the events in your team’s tracking plan.” But in the generated Javascript I see defined methods for my track events. For example 

websitePageView(properties, options) {
this.itly.track(new WebsitePageView(properties), options);
}
Answer: Are you sure you are using JavaScript and not TypeScript in this case?

 

Badge

The implementation page of my Iteratively account just shows this page. I have already added the sources in so not sure why it is asking me to add them again.

 

 

I am positive I am using Javascript. The only options for source I have chosen are Browser - Javascript and Browser - Javascript (Itly).

 

What is the difference between Browser - Javascript and Browser - Javascript (Itly). The first one generates an ampli folder whereas the second one generates itly folder. It is really confusing. What is the difference between them? Is one newer? Perhaps Itly is the one to use as that was acquired by Amplitude and the ampli generated source code a method from before Iteratively was acquired.

Userlevel 5
Badge +9

Hello @ballanty thank you for the clarification!

The Itly SDKs are the SDKs that were using when Iteratively was an independent company. These SDKs still work, but they are being deprecated.]

The above being said brings us to the Ampli SDKs. These were created when Iteratively joined Amplitude and these are the SDKs that will be supported moving forward.

To get a technical deepdive into the Ampli SDK, Ampli CLI, and how those work with our Amplitude SDKs please find this community post, here.

As for the implementation page, I am able to see instructions after adding a source. Check out these screenshots.

 

Reply