How do I get started with WordPress?

  • 30 November 2021
  • 9 replies
  • 477 views

Badge

Hi there

I’ve installed the JavaScript SDK code snippet using “Insert Headers and Footers” in settings and fired amplitude.getInstance().logEvent('EVENT_NAME_HERE'); to activate. 

Amplitude has picked up the activate signal but not picking up traffic or users. What have I missed?

Many thanks
Manoj


9 replies

Userlevel 5
Badge +2

Hi @skilleduplife ,

 

Thanks for writing into Community! Always great to see it being active!

 

So you have installed the JS SDK in the Header and the footer of the website on wordpress but it is not registering the events. I assume the API Key is correct and you are not using the Secret key?

 

Can you also follow the script and guide https://developers.amplitude.com/docs/javascript for the JS SDK as I believe the script there will give the newest version. Can you try that and see?

You said it was in the headers and footer section, can you make sure it is only in the header section before the <body> tag? I am not too familiar with WordPress but here seems to have an appropriate guide!

 

Can you make sure you have no VPNs or Ad-blockers? I would also make sure that WordPress isn’t blocking the SDK calls. I would try to see if the console brings up some errors or the network tab of your developer tools. 

 

I hope this helps! I am looking forward to your reply!

 

Kind Regards,
Denis

Badge

Hi Denis

I’m using the plugin you mentioned and it’s only added to the header. I used Javascript SDK and the code given under https://analytics.amplitude.com/SkilledUpLife/connections/project/334212/sources/setup/SDK_JS which includes the API key. 

Are you suggesting this script is old?

Noted at least one change "sha384-4rr7CTymHc64YjTTL6O3ktfsHYI1yJnQdmKv4zFoe+frjXb05MfzzuLLIAgJ/XHs” where as the code given to me with my keys for the same is “sha384-tzcaaCH5+KXD4sGaDozev6oElQhsVfbJvdi3//c2YvbY02LrNlbpGdt3Wq4rWonS”

In terms of the head, all scripts are appearing after <head> but before </head> and before <body>.

Inspection shows

<script type="text/javascript" integrity="sha384-tzcaaCH5+KXD4sGaDozev6oElQhsVfbJvdi3//c2YvbY02LrNlbpGdt3Wq4rWonS" crossorigin="anonymous" async="" src="https://cdn.amplitude.com/libs/amplitude-8.5.0-min.gz.js"></script>

Please advise.

Thanks
Manoj

Badge

The website is https://skilledup.life

Userlevel 5
Badge +2

Hi @skilleduplife ,


I think the script just doesn’t get the latest version. The one in the JS SDK specifies 

 

src="https://cdn.amplitude.com/libs/amplitude-8.11.0-min.gz.js"

While the data connections wizard displays 
src="https://cdn.amplitude.com/libs/amplitude-8.5.0-min.gz.js"

Can you make sure you are using 8.11.0 just to be sure? Thank you!

Noted at least one change "sha384-4rr7CTymHc64YjTTL6O3ktfsHYI1yJnQdmKv4zFoe+frjXb05MfzzuLLIAgJ/XHs” where as the code given to me with my keys for the same is “sha384-tzcaaCH5+KXD4sGaDozev6oElQhsVfbJvdi3//c2YvbY02LrNlbpGdt3Wq4rWonS”

This is just used for the different packages and will change between the versions.  just want to see if the latest version will alleviate any issues. And I assume no VPNs or Adblockers? Do you know if WordPress are blocking the SDK calls by any chance? I had a look at the website and I can see the Amplitude Script added to the home page so this is unusual. It is activated, you said, yes? 

Can you try to log an event with just amplitude.logEvent("Newest Signup"); and tell me if that works? Thank you!

Badge

Hi Denis

I replaced the whole code snippet and with only the API key changed. Nothing. 

This is becoming way too harder than anything I’ve used in the past.

Userlevel 5
Badge +2

Hi @skilleduplife ,

 

Did you try just amplitude.logEvent("EVENT_NAME_HERE"); instead of amplitude.getInstance().logEvent('EVENT_NAME_HERE');? I just want to be sure. 

 

In the meantime, while we try and troubleshoot the setup from our side, it might be a good idea to simultaneously contact the support team for WordPress just to ensure that it is set up correctly and/or they are not blocking Amplitude’s SDK calls. Are they able to verify that the code snippet is valid for their site? It should be but good to make sure it is not adding two <script> tags accidentally or something similar.

 

Have you tried to add a different script and does that work? Was it also a JS snippet?

Have you installed the chrome Amplitude Instrumentation Plugin? It can be helpful for debugging and checking if the SDK is connecting. 

Have you been able to run the JS SDK from a simple html file yourself? Are you able to send a simple event there trying both methods of logging? 
I would also try installing using npm locally and see if you can send an event then. 

Have you connected to a second wifi connection and tried then? 

How did you get confirmation that WordPress had activated the SDK may I ask?

 

Thanks!

 

Badge

Hi Denis

I’ll park this for the time being. WordPress is a CMS we use, which has millions of users. I doubt they would reply to me. 

We have many other analytics including Woopra, Intercom and so many, None of them presents with these issues.

Catch you another time. Thanks for trying to help.


All the best
Manoj

 

Userlevel 5
Badge +2

Hi @skilleduplife ,

 

I am more than happy to continue trying to troubleshoot this! I do think it might just be some setting somewhere that is not being enabled, especially if they activate the SDK but do not send the event. Are you sending it to the US server too? And not the EU Server URL? 

 

Kind Regards,
Denis

Userlevel 4
Badge +2

Hi @skilleduplife I’m Jeremie, your community manager. 😃 I wanted to circle back here to confirm that you were able to work things out here! Let me know!

Reply