Skip to main content
Solved

Can we set the options after initiating the SDK?


Forum|alt.badge.img

Hi,

We are using JavaScript SDK on our website. We want to enable attribution (utm, referrer etc.). After looking at the documentation, I see the options have to be enabled along with init command. Can we also enable these options after the init separately. We want do this because the SDK is placed on the web source code and we want to enable these options from GTM.

Best answer by Denis Holmes

Hi @ram_manohar !

 

Thanks for writing into the Community! Always good to see people use it. :)

 

With regards to the options for the SDK, there would be no way to enable the options after the SDK initialisation. They would need to be passed as an argument when initialising the SDK. If you are wondering if the options can be turned off and on, I am not sure but I will ask the Amplitude Engineers and enquire!

 

However, another option would be to initialise a second SDK instance at some point and then put in the options. You could also try to pass a new SDK initialisation with the options and work with that while making the first initialisation null. It would depend on your architecture and while I am not too familiar with GTMs layout, I think a second instance of the SKD is better. If the two can communicate between them, one could send a ‘flag’ or message of some sort of when to initialise the second instance with the options. Would this be something possible for you to implement?

View original
Did this topic help you find an answer to your question?

2 replies

Denis Holmes
Team Member
Forum|alt.badge.img+8
  • Team Member
  • 448 replies
  • Answer
  • July 7, 2021

Hi @ram_manohar !

 

Thanks for writing into the Community! Always good to see people use it. :)

 

With regards to the options for the SDK, there would be no way to enable the options after the SDK initialisation. They would need to be passed as an argument when initialising the SDK. If you are wondering if the options can be turned off and on, I am not sure but I will ask the Amplitude Engineers and enquire!

 

However, another option would be to initialise a second SDK instance at some point and then put in the options. You could also try to pass a new SDK initialisation with the options and work with that while making the first initialisation null. It would depend on your architecture and while I am not too familiar with GTMs layout, I think a second instance of the SKD is better. If the two can communicate between them, one could send a ‘flag’ or message of some sort of when to initialise the second instance with the options. Would this be something possible for you to implement?


Forum|alt.badge.img
  • Author
  • Novice
  • 3 replies
  • July 11, 2021

Thank you very much for your answer. I will check with our development team to know what is possible.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings