Gbakwunye Mgbasa Ozi Google Analytics Querystring Dynamically iji jQuery

jquery

Enyi Ndị na-eme achịcha Todd zitere m ihe ngwọta via Twitter maka nsogbu na enwebeghị m ohere ịmepụta azịza maka. Ebe ọ bụ na a na-akwado blọọgụ anyị na Compendium mgbe ụfọdụ na ngalaba nke abụọ maka onye ahịa, ọ ga-amasị anyị ịgafe Koodu mgbasa ozi Google Analytics na ngalaba nke mbu ka ha wee nwee ike soro ndi nleta nke oma.

Nsogbu ọzọ, n'agbanyeghị, na-eme ka ndị na - ede blọgụ gị tinye koodu mkpọsa campaign ihe na - ekwesịghị ịtụ anya. Ihe ngwọta ziri ezi bụ ahu nagide JavaScript ka dynamically ịgbakwunye mkpọsa koodu mgbe peeji ibu.

document.ready (ọrụ () {
var campaignQueryString = '? {mejupụta nke a}';
var targetDomain = '{mejupụta nke a}';
$ ("a [href = 'http: // www." + targetDomain + "]'"). nke ọ bụla (ọrụ () {
Nke a.href + = campaignQueryString;
});
});

Ngwọta a akọwapụtara na-eji ma na-achọ jQuery, ihe na-emeghe JavaScript ntọala. Abụ m nnukwu onye ofufe nke jQuery iji tinye ụfọdụ ihe ndị mara mma na ebe nrụọrụ weebụ . Anụla m nzaghachi na ụfọdụ ndị mmepe ụlọ ọrụ anaghị enwe ekele na ịnwa ịgbaso nsụgharị ahụ, agbanyeghị.

Ọ bụrụ na ị jiri koodu dị n'elu, ị ga-etinyerịrị Jquery. Aga m akwado itinye ya na Google. Ebe ọ bụ na ọtụtụ mmadụ na-eme nke a, ibe gị ga - ebu ngwa ngwa karịa ebe edobere koodu ahụ, ebe ebugogo ya tupu.


Google na-enye a URL Builder iji gosi gị otu esi ewu ụlọ ọrụ mgbasa ozi gị. Ọ bụrụ n'ịchọrọ ị nweta ọfụma, aga m akwado ịtinye ihe dịka isi okwu, edemede, ndị edemede, wdg.

otu okwu

  1. 1

Kedu ihe ị chere?

Ebe a na-eji Akismet iji belata spam. Mụta otu esi etinye usoro data gị.